Reputation: 2364
This issue doesn't seem to be the case with all of my projects, one in particular gives this issue when I run npm i
(node v6.9.4 (npm v5.6.0) <- also not sure if this is right):
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support:25:11: fatal error:
'pthread.h' file not found
# include <pthread.h>
The error log:
12788 verbose stack Error: [email protected] install: `node-gyp rebuild`
12788 verbose stack Exit status 1
12788 verbose stack at EventEmitter.<anonymous> (/Users/tom.firth/.nvm/versions/node/v6.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
12788 verbose stack at emitTwo (events.js:106:13)
12788 verbose stack at EventEmitter.emit (events.js:191:7)
12788 verbose stack at ChildProcess.<anonymous> (/Users/tom.firth/.nvm/versions/node/v6.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
12788 verbose stack at emitTwo (events.js:106:13)
12788 verbose stack at ChildProcess.emit (events.js:191:7)
12788 verbose stack at maybeClose (internal/child_process.js:877:16)
12788 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
12789 verbose pkgid [email protected]
12790 verbose cwd /Users/tom.firth/Sites/the-works
12791 verbose Darwin 16.7.0
12792 verbose argv "/Users/tom.firth/.nvm/versions/node/v6.9.4/bin/node" "/Users/tom.firth/.nvm/versions/node/v6.9.4/bin/npm" "i"
12793 verbose node v6.9.4
12794 verbose npm v5.6.0
12795 error code ELIFECYCLE
12796 error errno 1
12797 error [email protected] install: `node-gyp rebuild`
12797 error Exit status 1
12798 error Failed at the [email protected] install script.
12798 error This is probably not a problem with npm. There is likely additional logging output above.
12799 verbose exit [ 1, true ]
Both of these point to node-gyp rebuild
- I haven't had this installed globally before, but i've tried it with and without and get the same error.
I have xcode 9.1 installed and ran:
$ xcode-select --install
which gives: xcode-select: error: command line tools are already installed, use "Software Update" to install updates
I followed the steps in: npmjs.com/fixing-npm-permissions
$ gcc --version
which gives:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ which gcc
which gives:
/usr/bin/gcc
The node-gyp
issue makes me think it's related to the compiler but I have reinstalled xcode and node (via brew and nodejs.org)
Any help or suggestions would be really appreciated.
edit:
I have tried npm 3.10.10 because 5.6.0 obviously wasn't right. This was previously installed and didn't resolve the issue.
I installed xcode 8.2.1 to replace xcode 9.1, this didn't resolve the issue.
Upvotes: 1
Views: 1120
Reputation: 2364
I'm not entirely sure what the solution was.
xcode-select --install
) (Library/Developer/CommandLineTools
didn't exist before or after this installation) - xcode-select -p
changed its path from pointing to xcode to commandlinetools even
though the dir didn't exist.After this, my issue was resolved.
Upvotes: 0
Reputation: 5659
You basically need to install libtool
to make it work. This was same issue I had when I was using bcrypt
. If that doesn't seems to work you should have a look at this.
Also please check which version of python is installed supported version is 2.7 the latest 3.x is not supported yet as per node-gyp documentation. This node Js Workshop discuss more details about the gyp this should be of some help too.
Upvotes: 1