Apple clang version 11.0.0 (clang-1100.0.20.17)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/binVerbose output (from npm or node-gyp):
> electron-builder install-app-deps --arch x64
• electron-builder version=20.26.1
• rebuilding native production dependencies platform=darwin arch=x64
Error: /usr/local/Cellar/node/10.10.0/bin/node exited with code 1
Output:
> [email protected] install /Users/mattcowley/WebstormProjects/MagicCap/node_modules/better-sqlite3
> node-gyp rebuild
Error output:
make: *** No rule to make target `../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', needed by `Makefile'. Stop.
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:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/usr/local/Cellar/node/10.10.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mattcowley/WebstormProjects/MagicCap/node_modules/better-sqlite3
gyp ERR! node -v v10.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
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/mattcowley/.npm/_logs/2019-06-16T10_20_00_103Z-debug.log
at ChildProcess.childProcess.once.code (/Users/mattcowley/WebstormProjects/MagicCap/node_modules/builder-util/src/util.ts:255:14)
at Object.onceWrapper (events.js:273:13)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Socket.stream.socket.on (internal/child_process.js:381:11)
at Socket.emit (events.js:182:13)
at Pipe._handle.close (net.js:606:12)
From previous event:
at rebuild (/Users/mattcowley/WebstormProjects/MagicCap/node_modules/app-builder-lib/out/util/yarn.js:238:18)
at /Users/mattcowley/WebstormProjects/MagicCap/node_modules/app-builder-lib/src/util/yarn.ts:20:11
From previous event:
at installOrRebuild (/Users/mattcowley/WebstormProjects/MagicCap/node_modules/app-builder-lib/out/util/yarn.js:68:17)
at /Users/mattcowley/WebstormProjects/MagicCap/node_modules/electron-builder/src/cli/install-app-deps.ts:56:9
at Generator.next (<anonymous>)
at runCallback (timers.js:694:18)
at tryOnImmediate (timers.js:665:5)
at processImmediate (timers.js:647:5)
From previous event:
at installAppDeps (/Users/mattcowley/WebstormProjects/MagicCap/node_modules/electron-builder/out/cli/install-app-deps.js:174:17)
at then (/Users/mattcowley/WebstormProjects/MagicCap/node_modules/electron-builder/src/cli/cli.ts:42:48)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `electron-builder install-app-deps --arch x64`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall 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/mattcowley/.npm/_logs/2019-06-16T10_20_00_173Z-debug.log
Hello, so I updated my global installation of node-gyp and it is now failing with a very similar error when it goes to install [email protected], prior to reaching electron-builder...
Verbose output (from npm or node-gyp):
> [email protected] install /Users/mattcowley/WebstormProjects/MagicCap/node_modules/integer
> node-gyp rebuild
make: *** No rule to make target `../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', needed by `Makefile'. Stop.
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:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/usr/local/Cellar/node/10.10.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mattcowley/WebstormProjects/MagicCap/node_modules/integer
gyp ERR! node -v v10.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
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/mattcowley/.npm/_logs/2019-06-16T10_33_53_751Z-debug.log
Same issue occurs if node-gyp is forced to 5.0.0 in the package by doing npm i -g node-gyp@latest && npm config set node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"
I'm running Mac OS Catalina and encountered this issue. I was installing node-memwatch for my node application.
I've tried reinstalling using installer from the official website & brew install node
The error still popped up. My workaround was installing node using nvm instead. I still do not have an idea what actually causes the issue though.
same problem,seems the Catalina problem,andone have idea to solve it?
sorry to do this but I'm going to close this and suggest you take this up with the authors of electron-builder. It looks to me like it's a problem with invocation.
I also don't think we're going to be in a position to provide _any_ support for Catalina until it's actually released, we hardly have the people + bandwidth to deal with supported operating systems. Sorry.
@rvagg This isn't an issue with electron builder. Simply running npm i integer raises the same failure.
I want to restate that support for Catalina is a low priority until it's in (or closer to) GA. But we can certainly collect more data on it. I'm certainly not going to jump onto the Catalina train until GA so it's going to be up to you early adopters that are willing to deal with breakage like this and yak shave your way to fixes.
@Boxonical can you paste some output for your failed node-memwatch? Is it the same make: *** No rule to make target../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', needed by Makefile'. Stop. error?
The fact that it works from nvm is interesting because you're getting an entirely different pathing structure to the global / npm node_modules directory. Given Apple's propensity to screw with /usr/local I'm wondering if they've done something else funky with that that's messing up relative pathing into there.
So, for anyone that wants to help solve this, try this:
When you get an error output that starts with something like this:
> [email protected] install /Users/mattcowley/WebstormProjects/MagicCap/node_modules/integer
> node-gyp rebuild
and then yields a failure like this:
make: *** No rule to make target `../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', needed by `Makefile'. Stop.
cd into that first directory, e.g. /Users/mattcowley/WebstormProjects/MagicCap/node_modules/integer and do an ls ../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi using that second path that fails, and see if it resolves. Also try a realpath on that same path to see what it resolves to as an absolute non-linked path. If you're getting errors or weird results from that, mess around with that relative path a bit and see how you can make it work properly. That won't tell us how to fix it here (exactly) but it might give us a hint for how to approach it.
Sorry I'm unable to recreate the issue ever since I use nvm to workaround.
I've tried:
Prior to workaround I did encountered the same error
make: *** No rule to make target ../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi, needed by Makefile. Stop.
I'm more convinced this is a node pathing issue instead of package (integer / node-memwatch) issue
Following up to @rvagg I do have the same issue and relative to the node-gyp file calling it (build.js) the addon.gypi file _does_ exist. But the addon.gypi does not exist relative to the module being installed. The /usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi file realpath's to itself
I had the same issue and I think it is actually a problem with Catalina:
The processing of .. seams to be wrong; it doesn't show all directories (especially of the root directory):
cd /Users
ls ..
Device Users
While the actual contents of the root directory is:
ls /
Applications System bin etc mnt private tmp
Library Users cores home net sbin usr
Network Volumes dev installer.failurerequests opt sw var
Might have something to do with / root dir becoming Read-only...
There are some changes to the file system layout in Catalina that includes a RO /. They get around the problem of needing to have some paths writeable by using bidirectional symlinks into a writeable filesystem. You can do this in APFS because disk space isn't statically partitioned, which also explains why several filesystems are the same size.
Looks like /Users is either a symlink or FS-level abstraction. I don't have my laptop rn but might be useful to see if realpath /Users is different and if so that may be what's confusing GYP?
Realpath doesn't give any useful clues
realpath /Users
/Users
However i have found a workaround that solves the problem of node-gyp, by setting the config directories of npm to a different directory that doesn't have the problem, like /opt:
sudo mkdir /opt/node
sudo chown {user}: /opt/node
npm config set devdir /opt/node/npm
npm config set prefix /opt/node/npm-global
export PATH=~/opt/node/npm-global/bin:$PATH
Hello, I am being affected by this on macOS Catalina 10.15 GA. Reading the comments makes me suspect, like others, that Apples new security polices (https://support.apple.com/en-ca/HT210650) are the cause of the issue. Currently I manage node through brew. It would make sense that NVM would work properly, if this change was the cause of the issue. I am currently using Xcode 11.1, and I have the terminal tools installed.
...
Small update, I was able to get things working after installing node through NVM. However I still got an error until I removed the old modules in the project I am working on, and then reinstalled fresh copies. Which makes me unsure if NVM fixed the issue, or removing the old packages and lock fixed the issue. I thought I would write an update in case anyone else has problems after upgrading though.
@markandrewj, would you mind to describe all the steps you made to fix the issue? after upgrading some packages and node, my app is no longer working since it's unable to be compiled by node-gyp rebuild.
Thanks
Hey @jonbondani, before doing any of the following steps I outline, make sure you have updated xcode, and opened xcode, so it can install the most recent compiler tools. If you haven't done this node-gyp won't be able to compile correctly. For me though, even after I installed the latest version of xcode, I still had the same issue. The issue happens because parts of / are now read only in Catalina, which has been causing issues for node-gyp. According to the issue referenced in this thread though, the issue should be fixed now.
In the end, this is what worked for me:
As a note, one benefit you get from switching to NVM is the ability to add a .nvmrc to your project, which locks it to a specific node version.
make sure you have updated Xcode, and opened Xcode, so it can install the most recent compiler tools
There are TWO ways to do this:
Both work but both have their idiosyncrasies.
@cclauss I tied both of the methods you listed, before switching to NVM, without success.
@markandrewj, I've reinstalled xcode comandtools, use nvm to install latest LTS node and followed all the steps that you suggested, but always the same result:
yarn install
yarn install v1.19.1
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
[-/7] ⡀ waiting...
[-/7] ⡀ waiting...
[-/7] ⡀ waiting...
[4/7] ⡀ weak-napi
error /Users/****/node_modules/weak-napi: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/****/node_modules/weak-napi
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 2.7.10 found at "/usr/bin/python"
gyp info spawn /usr/bin/python
gyp info spawn args [
gyp info spawn args '/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/****/node_modules/weak-napi/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/****/Library/Caches/node-gyp/12.13.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/****/Library/Caches/node-gyp/12.13.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/****/Library/Caches/node-gyp/12.13.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/****/node_modules/weak-napi',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
LIBTOOL-STATIC Release/nothing.a
Traceback (most recent call last):
File "./gyp-mac-tool", line 611, in <module>
sys.exit(main(sys.argv[1:]))
File "./gyp-mac-tool", line 30, in main
exit_code = executor.Dispatch(args)
File "./gyp-mac-tool", line 45, in Dispatch
return getattr(self, method)(*args[1:])
File "./gyp-mac-tool", line 248, in ExecFilterLibtool
if not libtool_re.match(line) and not libtool_re5.match(line):
TypeError: cannot use a string pattern on a bytes-like object
make: *** [Release/nothing.a] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/****/.nvm/versions/node/v12.13.0/bin/node" "/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/****/node_modules/weak-napi
thanks
I'm not sure any of the following will help, but they are things you could try.
If none of this helps, you will probably find further information by looking for results for the given error.
TypeError: cannot use a string pattern on a bytes-like object
@jonbondani wrote:
I've reinstalled xcode comandtools
This is not all of Xcode so my bet is that xcodebuild -version only returned a message about xcode-select. If this is the case, and if Jon wishes to avoid installing all of Xcode then run the commands at https://github.com/nodejs/node-gyp/issues/1927#issuecomment-544961544 until com.apple.pkg.CLTools_Executables appears.
TypeError: cannot use a string pattern on a bytes-like object is Python 3 complaining about an incomplete port. Python 2 made no distinction between bytes and str but Python 3 strictly enforces that distinction. A quick fix would be use Python 2 for the install.
@markandrewj
I've tried all your suggestions and still nothing :(
@cclauss , on the first try:
/usr/sbin/pkgutil --packages | grep CL
com.apple.pkg.CLTools_Executables
com.apple.pkg.CLTools_SDK_macOSSDK
com.apple.pkg.CLTools_SDK_macOS1013
com.apple.pkg.CLTools_SDK_macOS1015
com.apple.pkg.CLTools_SDK_macOS1014
com.apple.pkg.CLTools_macOS_SDK
TypeError: cannot use a string pattern on a bytes-like object is Python 3 complaining about an incomplete port. Python 2 made no distinction between bytes and str but Python 3 strictly enforces that distinction. A quick fix would be use Python 2 for the install.
Tried using Python 2.7 (as suggested) with the same result:
yarn install
yarn install v1.19.1
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
[-/7] ⠠ waiting...
[-/7] ⠠ waiting...
[-/7] ⠠ waiting...
[4/7] ⠠ weak-napi
error /Users/****/node_modules/weak-napi: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/****/node_modules/weak-napi
Output:
gyp info it worked if it ends with ok
gyp info using **[email protected]**
gyp info using **[email protected] | darwin | x64**
gyp info find Python using **Python version 2.7.10** found at "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp info spawn /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
gyp info spawn args [
gyp info spawn args '/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/****/node_modules/weak-napi/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/****/Library/Caches/node-gyp/12.13.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/****/Library/Caches/node-gyp/12.13.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/****/Library/Caches/node-gyp/12.13.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/****/node_modules/weak-napi',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
LIBTOOL-STATIC Release/nothing.a
Traceback (most recent call last):
File "./gyp-mac-tool", line 611, in <module>
sys.exit(main(sys.argv[1:]))
File "./gyp-mac-tool", line 30, in main
exit_code = executor.Dispatch(args)
File "./gyp-mac-tool", line 45, in Dispatch
return getattr(self, method)(*args[1:])
File "./gyp-mac-tool", line 248, in ExecFilterLibtool
if not libtool_re.match(line) and not libtool_re5.match(line):
TypeError: cannot use a string pattern on a bytes-like object
make: *** [Release/nothing.a] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/****/.nvm/versions/node/v12.13.0/bin/node" "/Users/****/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/****/node_modules/weak-napi
I'm starting to despair, I've been stuck for two days without being able to move forward
Thanks for your help
I switched to node 8.12.0 and could rebuild, was failing for me with 10.15.3
@daniellizik Building on Python 2.7?
@cclauss yep, 2.7.16
I've had to revert all the modules updates to their original (outdated) versions and switched to node 10.15.x LTS, then I was able to rebuild the project.
It seems that some of the modules are incompatible with node versions +10.15.x but I wasn't able to identify all of them, I think one of them is weak-napi (I've opened an issue in their git's) but I don't know how to avoid using this module since is not part of my package-json
I'm running into this exact same issue. Even with the reference to weak-napi... I have tried using Node 10.x and 8.x to no avail. Just continually getting errors. Does anybody have any solutions for this problem or troubleshooting tips? For what its worth I have NOT upgraded to Catalina yet.
I'm running into this exact same issue. Even with the reference to weak-napi... I have tried using Node 10.x and 8.x to no avail. Just continually getting errors. Does anybody have any solutions for this problem or troubleshooting tips? For what its worth I have NOT upgraded to Catalina yet.
In reference to my own comment...
npm install --python=python2 / python2.7 / python2.7.16, etc was not working.
I manually ran pyenv shell 2.7.16 and then ran npm install and it worked.
Hooray I suppose, still not sure why this issue started randomly for me.
@BrandonGardner2 what node version did you used finally?
The err I got was not entirely the same, but here is a possible fix (worked for me).
Just removing package lock (or yarn lock) and doing npm i got rid of the err for me. npm i runs without errors now.
I installed node via brew.
node -v: v12.12.0
@lunatolun Can you please step through macOS_Catalina.md and let me know how your Mac does?
https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md
Upon opening Xcode I noticed the location for the Command Line Tools were empty. (Preferences > Locations). After selecting the tools there, I could run the install.
Thank you @hphoeksma
I added those steps to #1962
Same issue occurs if node-gyp is forced to 5.0.0 in the package by doing
npm i -g node-gyp@latest && npm config set node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"
solve my problem ,thanks
Removing package-lock.json and running npm install worked for me.
@hphoeksma thanks a lot!
Removing package-lock.json and running npm install also worked for me. Don't know why, but it does not seem to be a stable solution. I would go with nvm.
Upon opening Xcode I noticed the location for the Command Line Tools were empty. (Preferences > Locations). After selecting the tools there, I could run the install.
This from @hphoeksma comment and removing package-lock as @joshuabaker said fix it for me
Upon opening Xcode I noticed the location for the Command Line Tools were empty. (Preferences > Locations). After selecting the tools there, I could run the install.
It is useful to me, thanks!
That is all documented in https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md
I tried everything in this thread as well as the documentation posted by @cclauss but my issue was the my git repo local directory had a space in it "git repos". After removing the space I was able to install correctly. It appears that gyp doesn't handle spaces in git repository names very well.
the error I was seeing: as you can see the directory starts with 'repos' and not 'git repos':
clang: error: no such file or directory: 'repos/outlook-web-addin/node_modules/node-addon-api'
make: *** [Release/obj.target/weakref/src/weakref.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/npm-lifecycle/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:223:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/amcinerney/Documents/git repos/outlook-web-addin/node_modules/weak-napi
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok
如果将软件包中的node-gyp强制为5.0.0,则会发生相同的问题
npm i -g node-gyp@latest && npm config set node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"解决我的问题,谢谢
In case it helps someone: I still got the error although Xcode was installed on my machine. It works after executing `sudo xcode-select -s /Applications/Xcode.app/Contents/Developer.
https://docs.npmjs.com/misc/config#unsafe-perm
sudo npm i --unsafe-perm=true
I know I have Mojave, but maybe that can help someone, i spent 2 day for gyp error
In my case I downgraded node 13 to 11 .. and worked
React Native Environment Info:
Binaries:
Node: 11.10.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Android Studio: 3.0 AI-171.4443003
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: ^0.59.10 => 0.59.10
npmGlobalPackages:
react-native-cli: 2.0.1
Not sure why @cclauss got all the 👎 - I've been having node-gyp issued on Catalina on and off and finally went through his MD and cleared it all out using the acid test and the third (manual) install option. Thanks! Also +1 to @rrrix who found the solution that worked for me.
@theigor cuz does not work for everybody, in my case the acid tests pass but I still got the issue
It would be really cool if someone from Apple could jump in and document a permanent solution.
I did a full uninstall and reinstall of yarn, node, nvm and deleted my node_modules and still gave me the giant, unreadable node-gyp rebuild mess.
Downgrading the Node version with NVM helped. (I went from 12.16.1 to 8.17.0.) Kind of unfortunate, because it used to work with 13.3.0 but we'll just have to hacking our way until Apple can figure their mess out.
I solved the issue on my 16" MBP (clean Catalina install) by opening XCode, manually selecting the CLI install directory from the locations tab in preferences, then downgrading to node V11 using NVM.
Upon opening Xcode I noticed the location for the Command Line Tools were empty. (Preferences > Locations). After selecting the tools there, I could run the install.
Thank you so much @hphoeksma. your solution solved my problem.
Same issue occurs if node-gyp is forced to 5.0.0 in the package by doing
npm i -g node-gyp@latest && npm config set node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"
Thanks buddy
Removing
package-lock.jsonand runningnpm installworked for me.
That's true for me. I already had the xcode tools installed and didn't know why it was falling. It was a project that a coworker initialized on MS Windows. Running the following worked for me:
rm -rf node_modules package-lock.json
npm i
This issue seems to have ran its course. For people coming here through search engines: see https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md
Spent tens of hours trying to solve it (not successful). So I have decided to dive into JS and Py code for debugging.
under /usr/local/lib/node_modules/node-gyp/lib/configure.js line # 299 i found this:
var nodeLibFile = path.join(nodeDir,
!gyp.opts.nodedir ? '<(target_arch)' : '$(Configuration)',
release.name + '.lib')
which caused me some problems (not sure if this is the right syntax for template strings in JS...). It resulted the args array (passed to py scripts) to include the following item:
-Dnode_lib_file=/Users/josh/Library/Caches/node-gyp/12.13.1/<(target_arch)/node.lib',
obviously .../<(target_arch)/... is not a valid path (it was supposed to be replaced with gyp.opts - arguments/options from terminal).
I don't understand how it worked for others if there is an internal error in the core lib of node-gyp
@eranhr You're probably using an old version of node-gyp / node-pre-gyp.
Make sure your dependencies/resolutions are using a recent version.
I use yarn and always add something like this:
"resolutions": {
"node-gyp": "^6.1.0",
"node-pre-gyp": "^0.14.0"
}
If you're using npm instead of yarn, you can use npm-force-resolutions to use the same kind of forced dependency resolution behavior as yarn.
One of the major benefits and major pitfalls of JS ecosystem is version pinning - however that sometimes results in old packages that don't ever get upgraded to use new versions of critical packages such as this.
This worked for me.
I noticed that xcodebuild was not available on the command line. I ended up needing too enable command line tools Under Xcode > Preferences > Locations
See the following,
https://stackoverflow.com/questions/24445229/why-is-xcodebuild-command-not-found-in-this-build-script
I fixed this by upgrading sharp in package.json. It's worth going through any packages that might be requiring node-gyp and making sure they're up to date.
Removing
package-lock.jsonand runningnpm installworked for me.That's true for me. I already had the xcode tools installed and didn't know why it was falling. It was a project that a coworker initialized on MS Windows. Running the following worked for me:
rm -rf node_modules package-lock.json npm i
Thank bro,
I have fixed my issue with this suggest
Most helpful comment
Same issue occurs if node-gyp is forced to 5.0.0 in the package by doing
npm i -g node-gyp@latest && npm config set node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"