Error: /usr/local/bin/node exited with code 1
Output:
> @paulcbetts/[email protected] install /Users/lei/project/electron/talk/node_modules/@paulcbetts/system-idle-time
> node-gyp rebuild
CXX(target) Release/obj.target/system_idle_time/src/module.o
CXX(target) Release/obj.target/system_idle_time/src/mac/idle.o
SOLINK_MODULE(target) Release/system_idle_time.node
Error output:
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/system_idle_time.node] 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/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:254:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp.js" "rebuild"
gyp ERR! cwd /Users/lei/project/electron/talk/node_modules/@paulcbetts/system-idle-time
gyp ERR! node -v v11.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @paulcbetts/[email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @paulcbetts/[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/lei/.npm/_logs/2019-07-16T07_00_00_331Z-debug.log
at ChildProcess.childProcess.once.code (/Users/lei/project/electron/talk/node_modules/builder-util/src/util.ts:244:14)
at Object.onceWrapper (events.js:273:13)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:978:16)
at Socket.stream.socket.on (internal/child_process.js:395:11)
at Socket.emit (events.js:182:13)
at Pipe._handle.close (net.js:616:12)
From previous event:
at _rebuild (/Users/lei/project/electron/talk/node_modules/app-builder-lib/src/util/yarn.ts:179:5)
at rebuild (/Users/lei/project/electron/talk/node_modules/app-builder-lib/out/util/yarn.js:163:19)
at /Users/lei/project/electron/talk/node_modules/app-builder-lib/src/util/yarn.ts:20:11
From previous event:
at _installOrRebuild (/Users/lei/project/electron/talk/node_modules/app-builder-lib/out/util/yarn.js:71:28)
at installOrRebuild (/Users/lei/project/electron/talk/node_modules/app-builder-lib/out/util/yarn.js:55:28)
at /Users/lei/project/electron/talk/node_modules/electron-builder/src/cli/install-app-deps.ts:58:9
at Generator.next (<anonymous>)
at processImmediate (timers.js:632:19)
From previous event:
at _installAppDeps (/Users/lei/project/electron/talk/node_modules/electron-builder/out/cli/install-app-deps.js:177:26)
at installAppDeps (/Users/lei/project/electron/talk/node_modules/electron-builder/out/cli/install-app-deps.js:146:26)
at then (/Users/lei/project/electron/talk/node_modules/electron-builder/src/cli/cli.ts:49:19)
How do I solve it?
This issue appears again and again. Exactly the same error for me
What does the command __sw_vers__ return?
you might need to upgrade, or reinstall your xcode (or xcode commandline tools).
The Pandas team did this: https://github.com/pandas-dev/pandas/issues/23424#issuecomment-446393981
I'm going to close this as 'answered'. It's not a node-gyp issue.
@bnoordhuis if it's not a node-gyp issue, maybe you can provide us with more details? or point to the FAQ where's explained how we can overcome it? it's a terribly bad situation and everybody continue blaming node-gyp for such unintuitive log.
I ran into this issue also when trying to build a working ionic-2 project after upgrading to Catalina from High Sierra. Everything worked fine on High Sierra but when I upgraded I ran into the issue described by stoneWeb when doing the initial
npm install to install all the packages needed for my project.
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After spending a whole day trying to figure out another "correct" mix of updated node module versions to pull, it came down to either patching a bunch of node modules or figuring out a way to convince clang to use the more recent version so I ended up writing a quick 'C' program to execute clang++ with updated parameters - basically overriding any passed in arguments with -mmacosx-version-min=10.5 or something old and changing it to -mmacosx-version-min=10.9 dynamically without me having to patch various node modules.
See the attached program.
To use it just build it with something like:
gcc clang_force.c -o clang_force
then copy it to /usr/local/bin
cp clang_force /usr/local/bin
then change the CXX environment variable to use it.
export CXX=/usr/local/bin/clang_force
That's it. Then just do the npm install again and everything is good. Hope someone finds it useful.
For those who hit this via Google: Updating to a newer version of Node seems to fix the problem for me.
For this particular project we were forced to stay at the version of node we were at due to legacy compatibility issues...
I was able to get around this by running the following prior to npm install:
export CPPFLAGS="-stdlib=libc++ -mmacosx-version-min=10.9"
export CFLAGS="-stdlib=libc++ -mmacosx-version-min=10.9"
export LDFLAGS="-mmacosx-version-min=10.9"
Most helpful comment
@bnoordhuis if it's not a node-gyp issue, maybe you can provide us with more details? or point to the FAQ where's explained how we can overcome it? it's a terribly bad situation and everybody continue blaming node-gyp for such unintuitive log.