node-geoip2 icon indicating copy to clipboard operation
node-geoip2 copied to clipboard

Failed at the [email protected] install script 'node-gyp rebuild'

Open felixfong227 opened this issue 9 years ago • 22 comments

image Everything is doing fine on my local development laptop,but when i move my app to Digital Ocean,the error start showing.

felixfong227 avatar Dec 04 '16 05:12 felixfong227

I am experiencing this exact problem myself. So can confirm that there is as issue

jardaroh avatar Jan 10 '17 11:01 jardaroh

What version of nodejs? And what distribution of Linux?

davidtsai avatar Feb 09 '17 02:02 davidtsai

Also, is there any additional logging in npm-debug.log with more details?

davidtsai avatar Feb 09 '17 02:02 davidtsai

Also ensure you have development tools installed on your server. geoip2 requires a C++ compiler in order to install.

davidtsai avatar Feb 09 '17 02:02 davidtsai

Both droplet and laptop and PC are using Node 7.5.0, and as for my droplet is using Ubuntu 16.04.1 x64,and my laptop is using OSX, and my PC is using Win10

felixfong227 avatar Feb 09 '17 05:02 felixfong227

I had the same issue, even though I had C++ compiler installed. Turned out node-gyp also requires python. On my Ubuntu machine after running sudo apt-get install python-minimal geoip2 installed without any errors.

bcronje avatar Mar 07 '17 22:03 bcronje

Same error, Windows 10

thEpisode avatar Mar 24 '17 17:03 thEpisode

Also facing this issue on ubuntu 16.04. Node version 8.5, node-gyp version 3.6.2

nitinet avatar Sep 24 '17 11:09 nitinet

Same issue on OSX,

In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__mutex_base:17: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support:301:12: error: use of undeclared identifier 'pthread_mach_thread_np' return pthread_mach_thread_np(pthread_self()); ^ 1 error generated. make: *** [Release/obj.target/node_mmdb/src/node_mmdb.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/Users/streek/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12) gyp ERR! System Darwin 16.7.0 gyp ERR! command "/Users/streek/.nvm/versions/node/v6.11.3/bin/node" "/Users/streek/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/streek/Dropbox/Web/prospectify/databyte-api/node_modules/geoip2 gyp ERR! node -v v6.11.3 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok npm WARN [email protected] No license field. npm ERR! Darwin 16.7.0 npm ERR! argv "/Users/streek/.nvm/versions/node/v6.11.3/bin/node" "/Users/streek/.nvm/versions/node/v6.11.3/bin/npm" "install" "geoip2" npm ERR! node v6.11.3 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the geoip2 package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs geoip2 npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls geoip2 npm ERR! There is likely additional logging output above. `

Streek avatar Sep 25 '17 20:09 Streek

@nitinbansal1989 @Streek did you guys try my workaround above: sudo apt-get install python-minimal as per comment https://github.com/davidtsai/node-geoip2/issues/20#issuecomment-284886497 ?

bcronje avatar Sep 25 '17 20:09 bcronje

Do you know if that package is on brew or ports?

Streek avatar Sep 25 '17 20:09 Streek

No idea. python-minimal is just a minimal subset of the python package. You can installing the full python package from brew or ports and that should do the trick as well.

bcronje avatar Sep 25 '17 20:09 bcronje

I had a similar issue with the node package xml2json. It looks like node-gyp is for compiling native modules for nodejs. That package used node-expat which is a C++ or C lib that has to be built on the architecture of the machine when npm install is ran.

I fixed this by making sure make and g++. I did this on a brand new 14.04 AWS box. I took this for granted when building on my own machine.

sudo apt-get install make
sudo apt-get install g++

TLDR: I think node-gyp is the visible side-effect of the native build going wrong, make sure you have make and g++ or gcc.

theoriginalgangster avatar Sep 29 '17 05:09 theoriginalgangster

Having the same error as @Streek. Standard OSX install, node v8.6.0, node-gyp 3.6.2. Python seems to be on my system and working just fine.

jljorgenson18 avatar Sep 30 '17 00:09 jljorgenson18

i have already installed python 2.7.14 still this is getting me the error.

nitinet avatar Oct 03 '17 05:10 nitinet

Agree that it fails to compile on OS X Sierra 10.12.6 with the error given by @Streek .

c++ --version gives: Apple LLVM version 9.0.0 (clang-900.0.37) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

g++ --version 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.37) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

node --version: v8.6.0

python --version Python 2.7.10

I also tried installing gcc v6 using homebrew and forced gyp to use it by setting the CC and CXX environment variables to gcc-6. This fails with: gcc-6: error: unrecognized command line option '-stdlib=libc++' gcc-6: error: unrecognized command line option '-stdlib=libc++'

MelissaClark avatar Oct 20 '17 09:10 MelissaClark

@MelissaClark I'm also on OS X sierra and am unable to reproduce with the same node & python versions. On OS X, the default compiler should be clang that is installed through xcode. What does your command prompt return for:

cpp --version
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

davidtsai avatar Oct 21 '17 02:10 davidtsai

@davidtsai I still have the problem and cpp --version returns

Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Although it's in a different install dir (don't know why), I guess it should still work. This issue is quite sad.

htamas avatar Oct 27 '17 15:10 htamas

@davidtsai are you using the latest Xcode CLI tools? There was an update on 17th October. The latest is v9.0 (macOS Sierra version 10.12)

htamas avatar Oct 30 '17 09:10 htamas

Hi have the same error with macOS Sierra 10.12.6

Hi have the same error gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit ($HOME/.nvm/versions/node/v6.11.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Darwin 16.7.0 gyp ERR! command "$HOME/.nvm/versions/node/v6.11.2/bin/node" "$HOME/.nvm/versions/node/v6.11.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd $HOME/src/project/api.early-birds/node_modules/geoip2 gyp ERR! node -v v6.11.2 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok

make, gpp, gcc, python are installed

nmathon avatar Nov 14 '17 08:11 nmathon

Actually, it turns out I only had commandline tools installed. Installing XCode proper (92?) fixed the problem for me

same error on a nearly brand new macbook sierra 10.12.6 with xcode installed

dantaub avatar Dec 01 '17 23:12 dantaub

https://github.com/runk/node-maxmind/wiki/Most-Efficient-Integration-Methods

knoxcard avatar Dec 28 '18 05:12 knoxcard