davidtsai / node-geoip2

Maxmind GeoIP2 database reader for geolocating ip addresses.
MIT License
61 stars 24 forks source link

Failed at the geoip2@1.0.5 install script 'node-gyp rebuild' #20

Open felixfong227 opened 7 years ago

felixfong227 commented 7 years ago

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

jardaroh commented 7 years ago

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

davidtsai commented 7 years ago

What version of nodejs? And what distribution of Linux?

davidtsai commented 7 years ago

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

davidtsai commented 7 years ago

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

felixfong227 commented 7 years ago

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

bcronje commented 7 years ago

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.

thEpisode commented 7 years ago

Same error, Windows 10

nitinet commented 7 years ago

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

Streek commented 7 years ago

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 databyte-api@5.0.0 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! geoip2@1.0.5 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the geoip2@1.0.5 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. `

bcronje commented 7 years ago

@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 ?

Streek commented 7 years ago

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

bcronje commented 7 years ago

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.

theoriginalgangster commented 7 years ago

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.

jljorgenson18 commented 7 years ago

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.

nitinet commented 7 years ago

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

MelissaClark commented 7 years ago

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++'

davidtsai commented 7 years ago

@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
htamas commented 7 years ago

@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 commented 7 years ago

@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)

nmathon commented 7 years ago

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

dantaub commented 6 years ago

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
knoxcard commented 5 years ago

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