When I try to run unit tests on my CDK Java project with mvn test, I get an error that Node v8.9.1 has reached end-of-life and is not supported..
But Node v12.22.1 is my current version, which I check right before running Maven.
node --version
v12.22.1
mvn test
....
Curiously, if I run Maven through the IntelliJ GUI, it works.
I have set my node version with nvm, if that matters. And I'm on a Mac.
Is there some environment variable I need to set? How does the CDK determine which node to use?
Any ideas?
Thanks!
Full output:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! !!
!! Node v8.9.1 has reached end-of-life and is not supported. !!
!! You may to encounter runtime issues, and should switch to a supported release. !!
!! !!
!! As of the current release, supported versions of node are: !!
!! - ^12.7.0 !!
!! - ^14.5.0 !!
!! - ^16.3.0 !!
!! !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(node:14462) Warning: process.on(SIGPROF) is reserved while debugging
/private/var/folders/nr/dkx1p38s24nb7fx_qgcxggcm0000gn/T/jsii-java-runtime8055040669944096944/lib/program.js:467
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Two things could be causing this.
In your build spec, you haven't specified the runtime env as node. Even if you manually install node yourself, and the --version command returns it, when the commands run on your code build it will use the default. You have to define it in your codebuild buildspec.yaml with:
phases:
install:
runtime-versions:
nodejs: 12
If you don't specify this runtime-version, then any commands run - such as mvn - that are not direct node commands will automatically use 8.9.1
assuming you have already provided this in your buildspec, then the other potential problem is your Codebuild Image. If you are not set to Standard2.0 or greater, then you cannot make use of runtimes- they will always default to the base runtimes of node 8. (see this reference for docker images on codebuild available ) -- Unless you really need to otherwise, you should be using Ubuntu Standard 5.0. It has the most recent backend code that utilizes the Buildspec and gives you the most control.
It is worth noting, if you are using CDK, and you don't specify a specific image to use it automatically defaults to Standard1.0 and the runtime-versions will be ignored. More annoyingly, if you are in Standard1.0 it will print a warning that runtime-versions is ignored but not stop the process... and since codebuilds ignore the --quiet flags of most commands, it can very easily get lost in the spam.
The Surefire plugin is using my /usr/local/bin/node, which was not installed with nvm. It was 8.9.1. I upgraded that node version and it works.
Related
I am getting this error:
arn:aws:cloudformation:us-east-1:<account>:stack/cdk-workshop/79cdc290-bb48-11ec-87f4-0a9e17cd1915
current credentials could not be used to assume 'arn:aws:iam::<account>:role/cdk-hnb659fds-lookup-role-<account>-us-east-1', but are for the right account. Proceeding anyway.
(To get rid of this warning, please upgrade to bootstrap version >= 8)
Everything works correctly, but I cannot find any documentation to tell me what bootstrap version I am on or how to change it. I have used npm to update the CDK version and then re-ran bootstrap without succcess.
You can check the AWS Cloudformation stack, and find a stack named "CDKToolkit". The version of the value of the output key name "BootstrapVersion" in the stack. If you can't find the "CDKToolkit" stack or just try to fix the problem quickly. You can exec 'npm bootstrap' under your project. CDK will create/update it for you.
Background
I have created a project using mix phx.new my_app --no-ecto and everything looked fine. However I am not able to run the created project.
Error
When I execute mix phx.server (after running mix deps.get)I get the following error:
===> Compiling ranch
===> Command ' OTP' not found in namespace bare
** (Mix) Could not compile dependency :ranch, "/home/user/.asdf/installs/elixir/1.7.3-otp-21/.mix/rebar3 bare compile --paths "/home/user/Workspace/exercises/islands_interface/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile ranch", update it with "mix deps.update ranch" or clean it with "mix deps.clean ranch"
OS and Language Info
Distributor ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
Codename: disco
elixir 1.7.3-otp-21
erlang 21.1
What am I doing wrong?
I just found out what the error was.
This is the absolute path of the project:
/home/user/Workspace/Functional Web Development with Elixir, OTP, and Phoenix/islands_interface
Turns out, phx.server errors out because it is inside the folder /Functional Web Development with Elixir, OTP, and Phoenix/. Turns out that space in ' OTP' in the error message is from the folder's name.
To prove my theory I created a project called test under /home/user/Workspace/. Everything worked perfectly.
Further investigation revealed the source of the problem. A Phoenix dependency, rebar3, has a bug with folders that have commas in their names.
https://elixirforum.com/t/phoenix-could-not-compile-dependency-ranch/22939/16?u=fl4m3ph03n1x
I wish to use an erlang client library to communicate with an mqtt broker for one of my projects. So I've started an application using rebar3's built-in templates and added emqttc as a dependency. Since erlang/otp 21 does not have support for gen_logger(emqttc depends on gen_logger) and the tuple_calls compiler options do not suffice, I had to downgrade to erlang#20 according to this post.
Now the issue with downgrading erlang is that, none of rebar3's commands(clean/compile/shell/report etc) work as expected and my previous projects built with rebar3 do not compile, I get to see this error message:
=ERROR REPORT==== 21-Aug-2018::12:54:29 === Loading of /usr/local/bin/rebar3/rebar/ebin/rebar3.beam failed: badfile escript:
exception error: undefined function rebar3:main/1 in function
escript:run/2 (escript.erl, line 759) in call from escript:start/1
(escript.erl, line 277) in call from init:start_em/1 in call from
init:do_boot/3
=ERROR REPORT==== 21-Aug-2018::12:54:29 === beam/beam_load.c(1863): Error loading module rebar3: This BEAM file was compiled for a later
version of the run-time system than 20. To fix this, please
recompile this module with an 20 compiler. (Use of opcode 160; this
emulator supports only up to 159.)
I've uninstalled and reinstalled rebar3, looked up on the web for this but nothing's clear and specific to rebar. Any help on this would be appreciated.
This may not be the exact answer for your question. But it may give you and idea.
What about using Docker. Its an easy way to keep your environment clean and neat.
If you use docker, you just have to include your new erlang version in Dockerfile as an environment variable.
ENV OTP_VERSION="20.3.6"
Check your _build/prod/rel/YOURAPPNAME/ directory. Most probably it has a release which doesn't match your erlang version. You can safely delete this directory and rebuild using rebar3 compile
Env: rebar 3.6.0 on Erlang/OTP 21 Erts 10.0 Ubuntu 16.04
When I try to install the rebar3 pulgins (such as rebar3_hex), it reports:
===> Package <<"rebar3_hex">> not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Plugin rebar3_hex not available. It will not be used.
There is only one line in my ~/.config/rebar3/rebar.config:
{plugins, [rebar3_hex]}.
as recommended in https://www.rebar3.org/docs/using-available-plugins#hex-package-management and https://github.com/tsloughter/rebar3_hex.
I can't get more useful information from google, rebar3 doc and existed question here.
So, I open a new question to ask Why and How to resolve it.
ps: I use proxychains for rebar3, it reports |DNS-response| repo.hex.pm is 151.101.54.2
inet_gethost[10708]: WARNING:Malformed reply (header) from worker process 10709.
In my case, it's fixed when set proxy environmental variable(http_proxy) instead of use proxychains.
I just installed Dart version 2.0.0-dev.64.1 and when running tests in WebStorm using the Dart VM I get the error:
Snapshot not compatible with the current VM configuration: the snapshot requires 'release no-strong no-type_checks no-asserts no-error_on_bad_type no-error_on_bad_override no-sync_async no-reify_generic_functio' but the VM has 'release strong no-type_checks no-asserts no-error_on_bad_type no-error_on_bad_override sync_async reify_generic_functions use_field_guards use_osr x64-win'
Isolate creation failed
I did not have this problem with V2.0.0-dev.63.0.
Any suggestions for fixing this?
My guess is that Webstorm is running run the pub snapshot from the SDK at bin/snapshots/pub.dart.snapshot however it doesn't seem to run with the default configuration of the VM in this build (there's a pub2.dart.snapshot in the same folder which does work).
Based on this comment this is a temporary issue because this version ships Dart2-enabled VM but the pub snapshot is not v2. Sounds like the next dev version will correct this.
So for now your best bet is to roll back to an earlier dev build, and then try again when the next one is available.