node-gyp error installing [email protected] on macOS Catalina

Created on 22 Jan 2020  路  3Comments  路  Source: nodejs/node-gyp


Hello! I can't install node apps, I get an error installing [email protected] (dependency I can't control)

  • Node Version: 10.16.3
  • Platform: MacOS Catalina 10.15.2 (19C57)
  • Module: [email protected]

Verbose output (from npm or node-gyp):

npm WARN deprecated [email protected]: Use uuid module instead

> [email protected] install /Users/XXXX/YY/projects/fury_mgcx-frontend/node_modules/fibers
> node build.js || nodejs build.js

/Users/XXX/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: line 5: /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js: No such file or directory
node-gyp exited with code: 127
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
Alpine users please run: `sudo apk add python make g++`
sh: nodejs: command not found

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] install: `node build.js || nodejs build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/XXXX/.npm/_logs/2020-01-22T05_16_54_899Z-debug.log

I really tried everything from this issue and here

I don't know what to do anymore. I've tried installing a new node version like 12.14.1 but I got the same error. Following the steps from macOS_Catalina.md I see all ok.

> /usr/sbin/pkgutil --packages | grep CL

com.apple.pkg.CLTools_Executables
com.apple.pkg.CLTools_SDK_macOS1015
com.apple.pkg.CLTools_SDK_macOS1014
com.apple.pkg.CLTools_macOS_SDK
com.kyocera.kyoceraMacintosh.PCL.pkg
> /usr/sbin/pkgutil --pkg-info com.apple.pkg.CLTools_Executables

package-id: com.apple.pkg.CLTools_Executables
version: 11.3.1.0.1.1576735732
volume: /
location: /
install-time: 1579667667
groups: com.apple.FindSystemFiles.pkg-group
> npm install -g node-gyp

+ [email protected]
updated 1 package in 9.992s
> xcode-select -version

xcode-select version 2373.
> xcode-select -print-path

/Library/Developer/CommandLineTools

I tried deleting /Library/Developer/CommandLineTools directory and then running xcode-select --install several times

Most helpful comment

This comes out of npm-lifecycle, which is a tool that npm uses to find node-gyp, see https://github.com/npm/npm-lifecycle/blob/latest/node-gyp-bin/node-gyp

Note the way it's looking up the path. It should work if it's allowed to run ../../node_modules/node-gyp/bin/node-gyp.js because then it'll use the node-gyp bundled with the npm that nvm installs. But since it's not, then my guess is you have a npm_config_node_gyp set. Look at npm config ls to see if you have a node_gyp set. Remove it if you do, with npm config delete node_gyp.

All 3 comments

@adrianescat Any progress? I'm facing the same problems as you.

This comes out of npm-lifecycle, which is a tool that npm uses to find node-gyp, see https://github.com/npm/npm-lifecycle/blob/latest/node-gyp-bin/node-gyp

Note the way it's looking up the path. It should work if it's allowed to run ../../node_modules/node-gyp/bin/node-gyp.js because then it'll use the node-gyp bundled with the npm that nvm installs. But since it's not, then my guess is you have a npm_config_node_gyp set. Look at npm config ls to see if you have a node_gyp set. Remove it if you do, with npm config delete node_gyp.

This comes out of npm-lifecycle, which is a tool that npm uses to find node-gyp, see https://github.com/npm/npm-lifecycle/blob/latest/node-gyp-bin/node-gyp

Note the way it's looking up the path. It should work if it's allowed to run ../../node_modules/node-gyp/bin/node-gyp.js because then it'll use the node-gyp bundled with the npm that nvm installs. But since it's not, then my guess is you have a npm_config_node_gyp set. Look at npm config ls to see if you have a node_gyp set. Remove it if you do, with npm config delete node_gyp.

@phr85 here.
@rvagg Look!

> npm config ls

; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.9.0 node/v10.16.3 darwin x64"

; userconfig /Users/XXXX/.npmrc
node_gyp = "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"

; node bin location = /Users/XXXX/.nvm/versions/node/v10.16.3/bin/node
; cwd = /Users/XXXX
; HOME = /Users/XXXX
; "npm config ls -l" to show all defaults.

I have node_gyp = "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" But this path doesn't exists for me, I don't know why this is set like this in the first place:

> cd /usr/local/lib/node_modules/node-gyp/bin/

cd: no such file or directory: /usr/local/lib/node_modules/node-gyp/bin/
> ls /usr/local/lib/node_modules

npm

I don't have any node-gyp in that directory, only npm. So I run npm config delete node_gyp and I can install fiber and my node apps now! @rvagg Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrewaustin picture andrewaustin  路  3Comments

jlchereau picture jlchereau  路  3Comments

lopezdp picture lopezdp  路  3Comments

halkar picture halkar  路  4Comments

gengjiawen picture gengjiawen  路  3Comments