mikeseven / node-glfw

nodejs bindings to GLFW
103 stars 46 forks source link

npm install fails on OSX 10.10.1 #23

Closed golgobot closed 8 years ago

golgobot commented 8 years ago

Here are version for npm, node, and node-gyp

Jonathans-MacBook-Pro-2:node-glfw jonathan$ node -v
v4.2.1
Jonathans-MacBook-Pro-2:node-glfw jonathan$ npm -v
2.14.7
Jonathans-MacBook-Pro-2:node-glfw jonathan$ node-gyp -v
v3.2.1

Installed prerequisites

Jonathans-MacBook-Pro-2:node-glfw jonathan$ brew install glfw3 anttweakbar glew
Warning: homebrew/versions/glfw3-3.1.2 already installed
Warning: anttweakbar-1.16 already installed
Warning: glew-1.13.0 already installed

Then npm install

Jonathans-MacBook-Pro-2:node-glfw jonathan$ npm install

> node-glfw@0.4.4 install /Users/jonathan/github/node-glfw
> node-gyp rebuild

/bin/sh: pkg-config: command not found
gyp: Call to 'pkg-config --libs glfw3 glew' returned exit status 127. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:355:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jonathan/github/node-glfw
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 

npm ERR! Darwin 14.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! node-glfw@0.4.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-glfw@0.4.4 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-glfw 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 their info via:
npm ERR!     npm owner ls node-glfw
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jonathan/github/node-glfw/npm-debug.log

Here is npm-debug.log

npm-debug.log

golgobot commented 8 years ago

Sorry forgot to preinstall nan and bindings, but it still fails

Jonathans-MacBook-Pro-2:node-glfw jonathan$ npm install --save bindings nan
bindings@1.2.1 node_modules/bindings

nan@2.1.0 node_modules/nan
Jonathans-MacBook-Pro-2:node-glfw jonathan$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.2.1
gyp info using node@4.2.1 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/jonathan/github/node-glfw/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/jonathan/.node-gyp/4.2.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/jonathan/.node-gyp/4.2.1',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/jonathan/github/node-glfw',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
/bin/sh: pkg-config: command not found
gyp: Call to 'pkg-config --libs glfw3 glew' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/jonathan/github/node-glfw
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok 
mikeseven commented 8 years ago

Seems like you forgot to install glfw3 and glew with homebrew. And you probably didn't install pkg-config, which usually is installed if you use homebrew for development ie gcc, automake etc...

Just go to homebrew Web page, install homebrew then do: brew update brew upgrade brew install glfw glew AntTweakBar pkg-config

--mike

On Thu, Dec 3, 2015 at 7:18 PM -0800, "Jonathan Ross" notifications@github.com<mailto:notifications@github.com> wrote:

Sorry forgot to preinstall nan and bindings, but it still fails

Jonathans-MacBook-Pro-2:node-glfw jonathan$ npm install --save bindings nan bindings@1.2.1 node_modules/bindings

nan@2.1.0 node_modules/nan Jonathans-MacBook-Pro-2:node-glfw jonathan$ node-gyp rebuild gyp info it worked if it ends with ok gyp info using node-gyp@3.2.1 gyp info using node@4.2.1 | darwin | x64 gyp info spawn /usr/bin/python gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/Users/jonathan/github/node-glfw/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/jonathan/.node-gyp/4.2.1/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/Users/jonathan/.node-gyp/4.2.1', gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=node.lib', gyp info spawn args '-Dmodule_root_dir=/Users/jonathan/github/node-glfw', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' ] /bin/sh: pkg-config: command not found gyp: Call to 'pkg-config --libs glfw3 glew' returned exit status 127 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:305:16) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Darwin 14.0.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "rebuild" gyp ERR! cwd /Users/jonathan/github/node-glfw gyp ERR! node -v v4.2.1 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok

Reply to this email directly or view it on GitHubhttps://github.com/mikeseven/node-glfw/issues/23#issuecomment-161861007.

golgobot commented 8 years ago

So I already ran the command brew install glfw3 anttweakbar glew like in the README.md and had those dependencies successfully installed on my system.

I did not have pkg-config installed, since I don't use brew for development and it wasn't in the README.md.

In any case, I installed pkg-config and tried again. But the build couldn't find AntTweakBar.h. I double checked and it was definitely in /usr/local/include. I went into atb.h and changed #include <AntTweakBar.h> to #inlcude "/usr/local/lib/AntTweakBar.h" and everything compiled fine. Not sure if it's a binding.gyp configuration issue, but this worked.

mikeseven commented 8 years ago

AntTweakBar doesn't have a pkg-config script but it should pick up the .h as a symlink into /udr/local/include. I'll double check if this is a brew install issue.

mikeseven commented 8 years ago

I just did everything from scratch on OS X 10.11, no issue at all. For me, homebrew did install AntTweakBar correctly with a link in /usr/local/include. My guess is that your system may not be installed correctly for HomeBrew. In particular, check that /usr/local/include is writable. Then reinstall homebrew packages and you should see /usr/local/include/AntTweakBar.h -> ../Cellar/anttweakbar/1.16/include/AntTweakBar.h