Node-red installation always finishing with error

Hello,
I tried different install methods, but always got error in same place.
Guess some system library not installed, can you suggest please how to fix this?

 npm install --production

> bcrypt@3.0.5 install /var/www/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-linux-x64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.5 and node@12.4.0 (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/var/www/node-red/node_modules/bcrypt/build'
  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 /usr/include/c++/6/cassert:44:0,
                 from /root/.node-gyp/12.4.0/include/node/node_object_wrap.h:26,
                 from ../../nan/nan.h:55,
                 from ../src/bcrypt_node.cc:1:
../../nan/nan_object_wrap.h: In destructor ‘virtual Nan::ObjectWrap::~ObjectWrap()’:
../../nan/nan_object_wrap.h:24:25: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
     assert(persistent().IsNearDeath());
                         ^
../../nan/nan_object_wrap.h: In static member function ‘static void Nan::ObjectWrap::WeakCallback(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’:
../../nan/nan_object_wrap.h:127:26: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
     assert(wrap->handle_.IsNearDeath());
                          ^
bcrypt_lib.target.mk:109: recipe for target 'Release/obj.target/bcrypt_lib/src/bcrypt_node.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
make: Leaving directory '/var/www/node-red/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/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 Linux 4.15.18-15-pve
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/var/www/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/var/www/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 /var/www/node-red/node_modules/bcrypt
gyp ERR! node -v v12.4.0
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/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/var/www/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> (/var/www/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 Linux 4.15.18-15-pve
node-pre-gyp ERR! command "/usr/bin/node" "/var/www/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /var/www/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v12.4.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/var/www/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 notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.5 (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

added 323 packages from 313 contributors and audited 1446 packages in 43.934s
found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

What hardware and operating system are you using and what do these commands show

node  -v
npm  -v
1 Like

Hi - whilst NPM shows lots of errors, these are related to an optional dependency failing to build. Note after all the errors, NPM itself only reports a warning:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.5 

And the last few lines actually confirm the overall install was successful.

I can see you are using node 12.x - we don't currently recommend that some modules with binary components haven't been updated for it yet. From this error it would appear bcrypt is such a module.

This is on Debian 9.9 (strech) running in LXC container.

$ node -v
v12.4.0
$ npm -v
6.9.0

Thank you, with node v11 everything works like charm!

Node versions 8 and 10 are the supported versions (see below). You may find some nodes are not compatible with 11. However if it is working you are probably ok.
https://nodered.org/docs/getting-started/installation