node-gyp: gyp ERR! stack Error: `make` failed with exit code: 2
I am trying to npm install my packages, and it seems a package named protagonist
needs node-gyp
I have literally tried everything I found online (issues here included) and still cant solve this.
2 days I have spent searching around, changing node versions, reinstalling python
and xcode tools
etc, its driving me crazy.
Where should I focus? Could this be the problem? : clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
But I have OS X 10.14…
I am literally at my wits end.
Any help really appreciated
-
Node Version:
$ node -v
v8.11.1
(tried with a lot of other versions too: 6.X, 10.X, etc) -
Platform:
macOS Mojave 10.14.3
Darwin USERNAME_Macbook-Pro.local 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64
-
Compiler:
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
-
Module: form the error log, its
protagonist@0.17.2
-
Python Version (if it matters):
$ python -V
Python 2.7.16
-
Xcode verion (if it matters):
$ /usr/bin/xcodebuild -version
Xcode 10.1
Build version 10B61
Verbose output (from npm or node-gyp):
protagonist@0.17.2 install /Users/user/project/project/node_modules/protagonist
node-gyp rebuild
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
CXX(target) Release/obj.target/libsnowcrash/snowcrash/src/CBlueprint.o
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
make: *** [Release/obj.target/libsnowcrash/snowcrash/src/CBlueprint.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/user/.nvm/versions/v8.11.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/user/.nvm/versions/v8.11.1/bin/node" "/Users/user/.nvm/versions/v8.11.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/user/project/project/node_modules/protagonist
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN marked-terminal@3.2.0 requires a peer of marked@^0.4.0 || ^0.5.0 || ^0.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN project No repository field.
npm WARN project No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protagonist@0.17.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the protagonist@0.17.2 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/user/.npm/_logs/2019-03-18T23_01_15_767Z-debug.log
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 15
- Comments: 34 (6 by maintainers)
In case someone else finds their way here for the same reason as I did: In my case it wasn’t “protagonist” (it was “fsevents” and something else).
My fix was to downgrade node from 12 to 11; I was in a project created on Node 11 and then I tried running it on a new computer with Node 12. Ideally I’d “roll forward” and update dependencies until it works on Node 12, of course, but I didn’t want to do that now.
I also experienced this issue, and it seemed my error also referenced fsevents. I believe this was also due to upgrading to Node 12. However @henrik I was able to resolve the issue without downgrading by following @codeforgeek’s instructions for the most part.
Make sure node build essentials are installed.
sudo apt-get install build-essential
Delete package-lock.json, /node_modules/ folder, and ~/.node-gyp/ folders.
rm package-lock.json && rm -rf node_modules && rm -rf ~/.node-gyp
Re-run npm install
npm install
Follow these steps to resolve the issue.
1: Make sure you have build-tools installed. 2: Update node-gyp 3: Delete package-lock.json and node modules folder and run npm install again. 4: Deleting ~/.node-gyp folder and run npm install again.
Source: https://codeforgeek.com/make-failed-with-exit-code-2/
if using yarn:
yarn upgrade
node-gyp
is the evil in the npm ecosystemI had the exact same issue after updating to Macos Catalina. After hours wasted looking for a solution, I fixed it by downgrading Node.js to 10.17.0. I hope this helps 😃
I downgraded to Node 10.x with Mac OS Catalina, and the issues were solved. I originally had 14.x and tried 12.x too, with no luck.
I downgraded to 10.16.0, and now its working.
Downgraded to v10.18.0 via brew install node@10, It’s now working.
that happened when i runned
$ npm install
(for react-ssr)Yes, that error describes the problem. protagonist@0.17.2 seems very old (https://github.com/apiaryio/protagonist/releases) and is setting
'MACOSX_DEPLOYMENT_TARGET': '10.5'
in it’s gyp scripts (https://github.com/apiaryio/protagonist/blob/7d25ee8622b4f981ecd05aeabd8e730858806aca/common.gypi#L128) which is less than the 10.7 needed to use libc++ on OS X.I’d suggest updating to a later version of protagonist to see if the problem has been fixed, and if it hasn’t raise an issue on their tracker: https://github.com/apiaryio/protagonist/issues
For those who are using AMI 2, I resolve it using
sudo yum groupinstall “Development Tools”
Since my errors were
@richardlau You are absolutely right!
Thank you very much for your time you took to reply and sorry.
Looks like you need at least protagonist@1.4.1: https://github.com/apiaryio/protagonist/pull/158/files
Node 11 is no longer supported, please choose an LTS version instead - 10 or 12.
Compile errors like this are almost certainly a problem with the addon you’re compiling, it’s not something we can change here. You need to take it up with the addon author - they need to upgrade their code to work with a newer Node.js, or you need to upgrade the version of the addon you’re installing because there’s a good chance they’ve already released a new version.
I look-read-apply many gyp error solution, and only worked “in my case” I downgraded node 13 to 11 …
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