Ever since the www/node package was updated to 9.x, the www/npm package won't work with it. Please see the error below:
This is because www/npm has dependencies towards www/node, www/node is at 9.x but www/npm is at 5.4.2, which is incompatible with Node.js 9. Furthermore, there appears to be no mechanism in place to use the LTS version of Node.js (currently 8.x) with www/npm. You can install www/node8 without a hitch. Once you're installing www/npm, it depends on www/node instead of www/node8 and will uninstall the latter. This leaves you in a catch-22 situation where www/node does not work with www/npm and www/npm does not allow www/node8 to be installed.
As I am using binary packages, compiling www/npm with Node 8 bindings is not feasible, as it would leave my system in a state that I would either have to compile everything from source all of the time, lock the packages and never be able to install bugfixes or have every update constantly update www/node while having a non-functional www/npm. This appears to be broken as of now.
In any case, it should be possible to easily use the LTS version instead of the latest one. I think the logic is upside down here: LTS should be the default with an optional Node 9 installation.
Any suggestions how to resolve this or is this a bug that should be reported to the package maintainer?
Code:
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.
Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is compatible with Node.js 9 and above.
/usr/local/bin/node[48876]: ../src/node_zlib.cc:437:static void node::(anonymous namespace)::ZCtx::Init(const FunctionCallbackInfo<v8::Value> &): Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed.
1: node::Abort(void) [/usr/local/bin/node]
2: node::Assert(char const* const[4]*) [/usr/local/bin/node]
3: _ZNSt3__16vectorIPN4node14SigintWatchdogENS_9allocatorIS3_EEE21__push_back_slow_pathIRKS3_EEvOT_ [/usr/local/bin/node]
4: v8::internal::FunctionCallbackArguments::Call(void(*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node]
5: v8::internal::Isolate*<v8::internal::Object> v8::internal::Builtins::InvokeApiFunction(v8::internal::Isolate*, bool, v8::internal::Handle<v8::internal::HeapObject>(int, v8::internal::Object*, v8::internal::HeapObject) [/usr/local/bin/node]
6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
This is because www/npm has dependencies towards www/node, www/node is at 9.x but www/npm is at 5.4.2, which is incompatible with Node.js 9. Furthermore, there appears to be no mechanism in place to use the LTS version of Node.js (currently 8.x) with www/npm. You can install www/node8 without a hitch. Once you're installing www/npm, it depends on www/node instead of www/node8 and will uninstall the latter. This leaves you in a catch-22 situation where www/node does not work with www/npm and www/npm does not allow www/node8 to be installed.
As I am using binary packages, compiling www/npm with Node 8 bindings is not feasible, as it would leave my system in a state that I would either have to compile everything from source all of the time, lock the packages and never be able to install bugfixes or have every update constantly update www/node while having a non-functional www/npm. This appears to be broken as of now.
In any case, it should be possible to easily use the LTS version instead of the latest one. I think the logic is upside down here: LTS should be the default with an optional Node 9 installation.
Any suggestions how to resolve this or is this a bug that should be reported to the package maintainer?