Thursday, November 11, 2021

[SOLVED] Ubuntu 18.04 - npm update - Error: [email protected] install: `node-pre-gyp install --fallback-to-build`

Issue

Attempted NodeJS versions:

  • 13.13.0
  • 12.16.2
  • 8.10.0

npm version: 6.14.4

Followed: https://askubuntu.com/questions/677498/unable-to-install-latest-nodejs-version-on-ubuntu-14-04 and typed:

curl -sL https://deb.nodesource.com/setup_0.13 | sudo bash -
sudo apt-get install -y nodejs
301 verbose stack Error: [email protected] install: `node-pre-gyp install --fallback-to-build`
301 verbose stack Exit status 1
301 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
301 verbose stack     at EventEmitter.emit (events.js:315:20)
301 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
301 verbose stack     at ChildProcess.emit (events.js:315:20)
301 verbose stack     at maybeClose (internal/child_process.js:1026:16)
301 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
302 verbose pkgid [email protected]
303 verbose cwd /home/2PG
304 verbose Linux 4.15.0-88-generic
305 verbose argv "/usr/bin/node" "/usr/bin/npm" "update"
306 verbose node v13.13.0
307 verbose npm  v6.14.4
308 error code ELIFECYCLE
309 error errno 1
310 error [email protected] install: `node-pre-gyp install --fallback-to-build`
310 error Exit status 1
311 error Failed at the [email protected] install script.
311 error This is probably not a problem with npm. There is likely additional logging output above.
312 verbose exit [ 1, true ]

Full Log: https://pastebin.com/V3N14w5p

When I type sudo apt-get install npm:

sudo apt-get install npm Steps to reproduce:

1) Create new DigitalOcean NodeJS droplet (v8.10.0)

2) Drag and drop https://github.com/theADAMJR/2PG using FileZilla

3) Go to the folder and type npm i


Solution

It's a known issue. That version of Node is not supported. I suggest you use 12.x.

If you want to use 13.x. I was able to install it correctly on 13.1.0, otherwise you'll need to wait until they update the package to support the version of node you want to use, this is a common issue with all native addons.



Answered By - Marcos Casagrande