[SOLVED] Node-RED 0.20.6 Installation Issue

Solution: Stick with recommended Node 10 LTS version.


When trying to install Node-RED 0.20.6 on macOS 10.14 with the recommended procedure, installation fails with the following details:

$ sudo npm install -g --unsafe-perm node-red
/usr/local/bin/node-red -> /usr/local/lib/node_modules/node-red/red.js
/usr/local/bin/node-red-pi -> /usr/local/lib/node_modules/node-red/bin/node-red-pi

> bcrypt@3.0.5 install /usr/local/lib/node_modules/node-red/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.5/bcrypt_lib-v3.0.5-node-v72-darwin-x64-unknown.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.5 and node@12.3.1 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
In file included from ../src/bcrypt_node.cc:1:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:24:25: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object,
      v8::NonCopyablePersistentTraits<v8::Object> >'
    assert(persistent().IsNearDeath());
           ~~~~~~~~~~~~ ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:93:25: note: expanded from macro
      'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
In file included from ../src/bcrypt_node.cc:1:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:127:26: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object,
      v8::NonCopyablePersistentTraits<v8::Object> >'
    assert(wrap->handle_.IsNearDeath());
           ~~~~~~~~~~~~~ ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:93:25: note: expanded from macro
      'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
2 errors generated.
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /usr/local/lib/node_modules/node-red/node_modules/bcrypt
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Darwin 18.6.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v12.3.1
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.5 (node_modules/node-red/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.5 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ node-red@0.20.6
added 327 packages from 313 contributors in 11.442s

However, node-red starts successfully.

$ node-red
21 Jun 20:06:31 - [info] 

Welcome to Node-RED
===================

21 Jun 20:06:31 - [info] Node-RED version: v0.20.6
21 Jun 20:06:31 - [info] Node.js  version: v12.3.1
21 Jun 20:06:31 - [info] Darwin 18.6.0 x64 LE
21 Jun 20:06:31 - [info] Loading palette nodes
21 Jun 20:06:32 - [info] Dashboard version 2.15.4 started at /ui
21 Jun 20:06:32 - [info] Settings file  : /Users/USER/.node-red/settings.js
21 Jun 20:06:32 - [info] Context store  : 'default' [module=memory]
21 Jun 20:06:32 - [info] User directory : /Users/USER/.node-red
21 Jun 20:06:32 - [info] Server now running at http://127.0.0.1:1880/
21 Jun 20:06:32 - [info] Active project : Check
21 Jun 20:06:32 - [info] Flows file     : /Users/USER/.node-red/projects/Check/Check.json
21 Jun 20:06:32 - [info] Starting flows
21 Jun 20:06:32 - [info] Started flows
21 Jun 20:06:32 - [info] [mqtt-broker:a8b56e55.2f1b4] Connected to broker: mqtt://localhost:1883
21 Jun 20:06:32 - [info] [mqtt-broker:3bc848d4.910e2] Connected to broker: mqtt://localhost:1883

It looks like the path https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.5/bcrypt_lib-v3.0.5-node-v72-darwin-x64-unknown.tar.gz doesn't exists. Correct one is https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v72-darwin-x64-unknown.tar.gz.

Any hint on what I am doing wrong? Thank you!

The recommended version is node 10 LTS

1 Like

The installation has not failed - as you've discovered.

We have one dependency marked as optional because it often causes problems like this. It is unfortunate that NPM's log output can be full of errors and relies on you spotting the WARN message at the end telling you it has skipped the dependency.

The version of bcrypt we have in NR 0.20.6 (3.0.5) does not support node 12 - it needs to be at 3.0.6 - so you will get this error message and fall back to the alternative bcryptjs module.

When I updated the dependencies for Node-RED 0.20.6, I failed to spot the bcrypt update was available - for the same reason your install succeeded; because its listed as optional, and npm outdated ignores it.

This is not the first time (nor the second) I've made that mistake - so will look at how to automate that check in the future.

1 Like

Thank you for the detailed explanations. I’ll revert to Node 10 LTS.

$ node -v
v10.16.0

$ sudo npm install -g --unsafe-perm node-red
Password:
/usr/local/bin/node-red -> /usr/local/lib/node_modules/node-red/red.js
/usr/local/bin/node-red-pi -> /usr/local/lib/node_modules/node-red/bin/node-red-pi

> bcrypt@3.0.5 install /usr/local/lib/node_modules/node-red/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
[bcrypt] Success: "/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote
+ node-red@0.20.6
added 364 packages from 350 contributors in 18.942s
1 Like