openhab-cloud icon indicating copy to clipboard operation
openhab-cloud copied to clipboard

npm failed on ubuntu 20.04 vps

Open Dual-0 opened this issue 4 years ago • 6 comments

Hi Guys,

I've got this error on the installation step "npm install"

  • VPS
  • Ubuntu 20.04
  • dependencies installed: build-essential redis-server mongodb nginx python (python-is-python2) nodejd npm

edit: I've run the "dependabot/npm_and_yarn/bcrypt-5.0.0" branch... got this errors too

Dual-0 avatar Sep 19 '20 22:09 Dual-0

I have this same issue.

make: *** [validation.target.mk:104: Release/obj.target/validation/src/validation.o] Error 1 make: Leaving directory '/root/openhab-cloud/node_modules/utf-8-validate/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/share/nodejs/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:198:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Linux 5.4.0-45-generic gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /root/openhab-cloud/node_modules/utf-8-validate gyp ERR! node -v v10.19.0 gyp ERR! node-gyp -v v6.1.0 gyp ERR! not ok

[email protected] install /root/openhab-cloud/node_modules/bcrypt node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v64-linux-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp) node-pre-gyp ERR! Tried to download(undefined): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v64-linux-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp) make: Entering directory '/root/openhab-cloud/node_modules/bcrypt/build' CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o make: Entering directory '/root/openhab-cloud/node_modules/bcrypt/build' CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o sed: can't read ./Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw: No such file or directory rm: cannot remove './Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw': No such file or directory make: *** [bcrypt_lib.target.mk:105: Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1 make: Leaving directory '/root/openhab-cloud/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/share/nodejs/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:198:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Linux 5.4.0-45-generic gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "build" "--fallback-to-build" "--module=/root/openhab-cloud/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/root/openhab-cloud/node_modules/bcrypt/lib/binding" gyp ERR! cwd /root/openhab-cloud/node_modules/bcrypt gyp ERR! node -v v10.19.0 gyp ERR! node-gyp -v v6.1.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/bin/node-gyp build --fallback-to-build --module=/root/openhab-cloud/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/root/openhab-cloud/node_modules/bcrypt/lib/binding' (1) node-pre-gyp ERR! stack at ChildProcess. (/root/openhab-cloud/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:198:13) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:982:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) node-pre-gyp ERR! System Linux 5.4.0-45-generic node-pre-gyp ERR! command "/usr/bin/node" "/root/openhab-cloud/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /root/openhab-cloud/node_modules/bcrypt node-pre-gyp ERR! node -v v10.19.0 node-pre-gyp ERR! node-pre-gyp -v v0.6.32 node-pre-gyp ERR! not ok

morph166955 avatar Oct 10 '20 20:10 morph166955

I've now tested this on Ubuntu 16, 18, and 20. All fail for different reasons. bcrypt seems to work on 18 and 16, but fail with the following errors:

npm ERR! typeerror Error: Missing required argument #1 npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3) npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22) npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12) npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7 npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50 npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12 npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5) npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7) npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20) npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50 npm ERR! typeerror This is an error with npm itself. Please report this error at: npm ERR! typeerror http://github.com/npm/npm/issues

node versions have been 4.x and 8.x as that is what is current in the ubuntu repos.

morph166955 avatar Oct 12 '20 21:10 morph166955

Apparently the nodejs version HAS to be 7.10.1. Instead of using APT to install nodejs, go to https://nodejs.org/dist/v7.10.1/ and pull the gz down. You are going to have to manually install it into /usr. Then npm install works.

morph166955 avatar Oct 18 '20 22:10 morph166955

You will also need to run:

npm install bcrypt bcryptjs@^2.4.3 qunitjs@^2.0.0 npm install time node-time

That seemed to fix a few things that didn't work properly after npm install runs.

morph166955 avatar Oct 18 '20 22:10 morph166955

Also run "mongo" and then run:

db.createUser( { user: "openhab", pwd: "openhab", roles: [ { role: "readWrite", db: "openhab" } ] } )

morph166955 avatar Oct 18 '20 22:10 morph166955

Apparently the nodejs version HAS to be 7.10.1. Instead of using APT to install nodejs, go to https://nodejs.org/dist/v7.10.1/ and pull the gz down. You are going to have to manually install it into /usr. Then npm install works.

... and be aware that after copy /usr/bin/npm is still a symlink to ../lib/node_modules/npm/bin/npm-cli.js ... else you get only Error: Cannot find module '../lib/utils/unsupported.js' when calling npm

giddel avatar Jan 07 '21 15:01 giddel