nodejs/node-gyp

trying to 'npm install', getting node-gyp rebuild errors

brascosDad opened this issue · 251 comments

ernestscomputer:musicomp ernest son$ npm install

> bufferutil@1.2.1 install /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/bufferutil
> node-gyp rebuild

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/include/node'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/src'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/uv/include'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/v8/include'
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
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.5.0
gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/bufferutil
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.2.1 Exit status 1

> utf-8-validate@1.2.1 install /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/utf-8-validate
> node-gyp rebuild

  CXX(target) Release/obj.target/validation/src/validation.o
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/include/node'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/src'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/uv/include'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/v8/include'
make: *** [Release/obj.target/validation/src/validation.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
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.5.0
gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/utf-8-validate
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate@1.2.1 Exit status 1

back story: in trying to uninstall iojs and reinstall node, I entered a world of shizzao but finally got node and npm installed successfully....I tried installing node-gyp globally to no avail...

Delete your $HOME/.node-gyp directory and try again.

Aside, many tools don't handle spaces in path names well (/Users/ernest son/...).

sorry, when you say "$home" do you essentially mean usr/local/bin? that's what "which node-gyp" yields in term...or do you mean another location?

I did change my user name by eliminating space for "_". thanks for the heads up

I mean the HOME environment variable. :-) node-gyp normally downloads the development tarballs to $HOME/.node-gyp, i.e., /home/username/.node-gyp or /Users/username/.node-gyp.

thanks, i figured out what you meant....just tried npm install and it appears i still have rebuild issues. it looks as though my user rename didn't propogate..(?)

> bufferutil@1.2.1 install /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/bufferutil
> node-gyp rebuild

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/include/node'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/src'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/uv/include'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/v8/include'
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
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.5.0
gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/bufferutil
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.2.1 Exit status 1

> utf-8-validate@1.2.1 install /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/utf-8-validate
> node-gyp rebuild

  CXX(target) Release/obj.target/validation/src/validation.o
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/include/node'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/src'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/uv/include'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/v8/include'
make: *** [Release/obj.target/validation/src/validation.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
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.5.0
gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/utf-8-validate
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate@1.2.1 Exit status 1
musiComp@1.0.0 /Users/ernest son/Desktop/PROJECTS/musicomp
├─┬ gulp@3.9.0
│ └─┬ vinyl-fs@0.3.14
│   └─┬ through2@0.6.5
│     └── readable-stream@1.0.33 
├─┬ gulp-clean@0.3.1
│ ├─┬ gulp-util@2.2.20
│ │ └─┬ through2@0.5.1
│ │   ├── readable-stream@1.0.33 
│ │   └── xtend@3.0.0 
│ └─┬ through2@0.4.2
│   └── readable-stream@1.0.33 
├─┬ gulp-concat@2.6.0
│ └─┬ through2@0.6.5
│   └── readable-stream@1.0.33 
├─┬ gulp-cssmin@0.1.7
│ └─┬ gulp-util@2.2.20
│   └─┬ through2@0.5.1
│     ├── readable-stream@1.0.33 
│     └── xtend@3.0.0 
├─┬ gulp-jshint@1.12.0
│ └─┬ through2@0.6.5
│   └── readable-stream@1.0.33 
├─┬ gulp-karma@0.0.5
│ ├─┬ gulp-util@2.2.20
│ │ └─┬ through2@0.5.1
│ │   ├── readable-stream@1.0.33 
│ │   └── xtend@3.0.0 
│ └─┬ optimist@0.6.1
│   └── minimist@0.0.10 
├─┬ gulp-ruby-sass@2.0.5
│ └─┬ vinyl-fs@1.0.0
│   └─┬ through2@0.6.5
│     └── readable-stream@1.0.33 
├─┬ karma@0.13.14
│ ├─┬ chokidar@1.2.0
│ │ └─┬ fsevents@1.0.5
│ │   └─┬ node-pre-gyp@0.6.15
│ │     └─┬ tar-pack@3.1.0
│ │       └── readable-stream@1.0.33 
│ └─┬ log4js@0.6.27
│   └── readable-stream@1.0.33 
└─┬ phantomjs@1.9.18
  └─┬ request@2.42.0
    └─┬ bl@0.9.4
      └── readable-stream@1.0.33 

Maybe you need to log out and log in again? It's also possible that $HOME/.npmrc has some outdated variables.

so redelete $HOME/.node-gyp and also .npmrc? logout and try again? I already restarted after user name change...

Maybe just edit your .npmrc in case it contains valuable things like tokens.

i see a .rvmrc folder in $HOME, but no .npmrc.....and how exactly would I edit it (if I could find it)?

If you don't have a .npmrc, don't worry about it. If you do, just vim will do; it's a text file.

I don't have one...any other ideas? I think I've tried everything on our
list
On Mon, Nov 9, 2015 at 1:39 PM Ben Noordhuis notifications@github.com
wrote:

If you don't have a .npmrc, don't worry about it. If you do, just vim will
do; it's a text file.


Reply to this email directly or view it on GitHub
#809 (comment).

getting same problem here when trying to install ember-cli

same problem here with contextify.

for me, the solution was fixing the space in my home folder (that was a whole other "can o' worms"). then 'npm install' worked like a charm. also, I suggest reaching out to the folks at npm if it truly is npm related. They're great!

I also had the node-gyp rebuild error while installing utf-8-validate package through npm. Removing the space from my filepath worked for me.

Same with botkit. howdyai/botkit#2

aroc commented

Ok, so I do not have a space in my filepath. I deleted the ~/.node-gyp folder and then the ~/.npmrc file. Restarted my computer. Then tried again and it worked. Hope that helps someone else out there!

@aroc It doesn't helped for me :(

Thanks @bnoordhuis! I had the same issue with no spaces in my file path. Deleting the original node_modules folder from my project, then deleting .node-gyp (I did not have .npmrc), restarting, and installing node in my project again with (sudo npm install) worked with no errors.

Node v5.2.0

Yikes. It scares me to think how low-level this is that a machine restart is a potential solution...

I had similar issues on Ubuntu 14.04, after trying everything here I finally solved it by running:

sudo apt-get install build-essential

As is recommended here: https://nodejs.org/en/download/package-manager/

I already had build-essential installed, installing libkrb5-dev did the trick for me:

apt-get install libkrb5-dev

For me, just deleting the ~/.node-gyp folder, then running npm update on my project solved the problem (without rebooting). Thank for the trick!

Run into same error when trying to download dependencies for angular-phonecat . I solved it by using @bnoordhuis method just the same way @JxnGraphix put it.

Node 4.2.3

I also deleted the node_modules directory I had (including .node-gyp and all), solved my issue. No restart.

Thanks @aroc I removed ~/.node-gyp and ~/.npmrc. In my project I removed node_modules and restarted my machine (restart might not be necessary) and all worked great.

node v4.1.2
npm 2.14.4
OS X El Capitan

Thanks @JxnGraphix - your solution worked for me

Node v5.7.0

for me helped:
apt-get install libkrb5-dev

thanks @samgranger

Had a problem with this rebuilding node-sass, deleting ~/.node-gyp and npm update did it for me.

Closing, looks like this issue ran its course.

Running node 6.2.0 here and getting getting node-gyp error. Anyone had this issue with this version of node.js ?

@novarac23 I'm getting it with node 6.1.0

Same here, node v6.2.1

Here as well, node v6.2.1

Yes same here also... node v6.2.1 with Windows OS

To solve this I downgraded node to v5.12.0, removed ~/.node-gyp folder and reinstalled node modules.

presleguine solution worked for me but downgrading the node to v4.4.7

arvi commented

I tried many suggestions and the only thing that worked is @JxnGraphix solution. Steps are:

  • Delete .node-gyp from root
  • Go to project directory then delete node_modules folder
  • sudo npm install

Finally.... Wew!

Update:
I encountered it again and instead of doing the above, this solution (symlinking node to nodejs) worked for me also.

  • Go to project directory then delete node_modules folder, then do this:
    sudo ln -s `which nodejs` /usr/bin/node
    sudo npm install

Dang it I just don't have luck with Node these days.

I tried to downgrade the version to 4.x.x and removed node-gyp and removed node-modules from the project and still nothing... 😢

Working on RHEL6 here.
Same problem with v6.2.1
Everything goes again smoothly when downgrading to v5.12.0 (I use nvm for simplicity)

rvagg commented

If you don't have a space in your username then you're probably not experiencing the same problem as the original poster. If you're getting compile failures it could be because of your build environment setup or the package that you're trying to install has some problem with the version of Node.js you're using. If you still think it's a node-gyp problem then please paste your full output to a gist or similar and give us the URL so we can see if there's anything to be gleaned from it.

s2geometry-node@1.3.1 install /Users/chadsfather/Desktop/All Your Desktop Groups Files/Escritorio/proyectos_web/pokeradar/testpk/node_modules/s2geometry-node
node-gyp rebuild

CXX(target) Release/obj.target/NativeExtension/src/NativeExtension.o
c++: error: unrecognized command line option '-stdlib=libc++'
make: *** [Release/obj.target/NativeExtension/src/NativeExtension.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/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:204:12)
gyp ERR! System Darwin 15.5.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/chadsfather/Desktop/All Your Desktop Groups Files/Escritorio/proyectos_web/pokeradar/testpk/node_modules/s2geometry-node
gyp ERR! node -v v6.2.2
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN pokeradar@1.0.0 No repository field.
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.2.2
npm ERR! npm v3.8.3
npm ERR! code ELIFECYCLE

npm ERR! s2geometry-node@1.3.1 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the s2geometry-node@1.3.1 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 s2geometry-node 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 s2geometry-node
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls s2geometry-node
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/chadsfather/Desktop/All Your Desktop Groups Files/Escritorio/proyectos_web/pokeradar/testpk/npm-debug.log

OS X El Capitan
node v6.2.2
npm 3.8.3

Just parroting the issue : I've had two completely separate applications fail to build in the last week, apparently due to node-gyp rebuild. One is a meteor app, running on win7, the other is on an ubuntu box - a mature application, suddenly breaking. I get very similar output to the above, due to two separate, and unrelated, parent packages (bcrypt and contextify).

Sample output :

make: Leaving directory `/users/jbosworth/fusion-dgo/node_modules/jsdom/node_modules/contextify/build'
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
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 Linux 3.13.0-63-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /users/jbosworth/fusion-dgo/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v4.4.4
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 3.13.0-63-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.4.4
npm ERR! npm  v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! contextify@0.1.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.13 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the contextify 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 contextify
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /users/jbosworth/fusion-dgo/npm-debug.log

Current versions of node / npm

Have not found a solution, yet.

+1 to this issue. I've tried all of the above, downgraded from 6 > 5, then 5 > 4 using n with no luck.

npm-debug.log snippet

1290 verbose stack Error: v8-debug@0.4.6 install: `node-pre-gyp install --fallback-to-build`
1290 verbose stack Exit status 1
1290 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
1290 verbose stack     at emitTwo (events.js:100:13)
1290 verbose stack     at EventEmitter.emit (events.js:185:7)
1290 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
1290 verbose stack     at emitTwo (events.js:100:13)
1290 verbose stack     at ChildProcess.emit (events.js:185:7)
1290 verbose stack     at maybeClose (internal/child_process.js:850:16)
1290 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
1291 verbose pkgid v8-debug@0.4.6
1292 verbose cwd /home/drew/code/mean/app
1293 error Linux 4.4.0-31-generic
1294 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
1295 error node v5.12.0
1296 error npm  v3.8.6
1297 error code ELIFECYCLE
1298 error v8-debug@0.4.6 install: `node-pre-gyp install --fallback-to-build`
1298 error Exit status 1
1299 error Failed at the v8-debug@0.4.6 install script 'node-pre-gyp install --fallback-to-build'.
1299 error Make sure you have the latest version of node.js and npm installed.
1299 error If you do, this is most likely a problem with the v8-debug package,
1299 error not with npm itself.
1299 error Tell the author that this fails on your system:
1299 error     node-pre-gyp install --fallback-to-build
1299 error You can get information on how to open an issue for this project with:
1299 error     npm bugs v8-debug
1299 error Or if that isn't available, you can get their info via:
1299 error     npm owner ls v8-debug
1299 error There is likely additional logging output above.
1300 verbose exit [ 1, true ]

@Bosworth99 @drewsmith You are omitting the actual build error.

@bnoordhuis - I believe this should be more helpfull :

> contextify@0.1.13 install /users/jbosworth/fusion-dgo/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild

make: Entering directory `/users/jbosworth/fusion-dgo/node_modules/jsdom/node_modules/contextify/build'
  CXX(target) Release/obj.target/contextify/src/contextify.o
In file included from ../node_modules/nan/nan_new.h:181:0,
                 from ../node_modules/nan/nan.h:74,
                 from ../src/contextify.cc:3:
../node_modules/nan/nan_implementation_12_inl.h: In static member function ‘static NanIntern::FactoryBase<v8::Signature>::return_t NanIntern::Factory<v8::Signature>::New(NanIntern::Factory<v8::Signature>::FTH, int, NanIntern::Factory<v8::Signature>::FTH*)’:
../node_modules/nan/nan_implementation_12_inl.h:172:76: error: no matching function for call to ‘v8::Signature::New(v8::Isolate*, NanIntern::Factory<v8::Signature>::FTH&, int&, NanIntern::Factory<v8::Signature>::FTH*&)’
   return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
                                                                            ^
../node_modules/nan/nan_implementation_12_inl.h:172:76: note: candidate is:
In file included from /users/jbosworth/.node-gyp/4.4.4/include/node/node.h:42:0,
                 from ../src/contextify.cc:1:
/users/jbosworth/.node-gyp/4.4.4/include/node/v8.h:4675:27: note: static v8::Local<v8::Signature> v8::Signature::New(v8::Isolate*, v8::Local<v8::FunctionTemplate>)
   static Local<Signature> New(
                           ^
/users/jbosworth/.node-gyp/4.4.4/include/node/v8.h:4675:27: note:   candidate expects 2 arguments, 4 provided
In file included from ../src/contextify.cc:3:0:
../node_modules/nan/nan.h: At global scope:
../node_modules/nan/nan.h:165:25: error: redefinition of ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)’
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                         ^
../node_modules/nan/nan.h:160:25: error: ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)’ previously declared here
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                         ^
../node_modules/nan/nan.h:500:13: error: ‘node::smalloc’ has not been declared
     , node::smalloc::FreeCallback callback
             ^
../node_modules/nan/nan.h:500:35: error: expected ‘,’ or ‘...’ before ‘callback’
     , node::smalloc::FreeCallback callback
                                   ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’:
../node_modules/nan/nan.h:504:50: error: ‘callback’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                  ^
../node_modules/nan/nan.h:504:60: error: ‘hint’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                            ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’:
../node_modules/nan/nan.h:511:67: error: call of overloaded ‘New(v8::Isolate*, const char*&, uint32_t&)’ is ambiguous
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
../node_modules/nan/nan.h:511:67: note: candidates are:
In file included from ../node_modules/nan/nan.h:25:0,
                 from ../src/contextify.cc:3:
/users/jbosworth/.node-gyp/4.4.4/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/users/jbosworth/.node-gyp/4.4.4/include/node/node_buffer.h:31:40: note:   no known conversion for argument 3 from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’
/users/jbosworth/.node-gyp/4.4.4/include/node/node_buffer.h:43:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/users/jbosworth/.node-gyp/4.4.4/include/node/node_buffer.h:43:40: note:   no known conversion for argument 2 from ‘const char*’ to ‘char*’
In file included from ../src/contextify.cc:3:0:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:515:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’
     return node::Buffer::New(v8::Isolate::GetCurrent(), size);
                                                             ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’:
../node_modules/nan/nan.h:522:12: error: ‘Use’ is not a member of ‘node::Buffer’
     return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
            ^
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
make: Leaving directory `/users/jbosworth/fusion-dgo/node_modules/jsdom/node_modules/contextify/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
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 Linux 3.13.0-63-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /users/jbosworth/fusion-dgo/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v4.4.4
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 3.13.0-63-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.4.4
npm ERR! npm  v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! contextify@0.1.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.13 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the contextify 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 contextify
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

This is a ubuntu box,
node v4.4.4
npm v2.15.1

Having a very similar issue with the Bcrypt package on a win7 box:
node v6.3.0
npm 3.10.3

Thanks for looking into this.

@Bosworth99 That is not a node-gyp issue. The build errors indicate that the module doesn't support node.js v4. Try upgrading to the latest contextify release.

@bnoordhuis - thats a good tip. Will work on it.

Thanks for the quick response -

gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@6.3.1 | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\Users\Deeksha Gupta\AppData\Roaming\npm\node_modules\node-gyp\gyp\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\Deeksha Gupta\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\Deeksha Gupta\AppData\Roaming\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\Deeksha Gupta.node-gyp\6.3.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=C:\Users\Deeksha Gupta.node-gyp\6.3.1',
gyp info spawn args '-Dnode_gyp_dir=C:\Users\Deeksha Gupta\AppData\Roaming\npm\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\Users\Deeksha Gupta',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\Users\Deeksha Gupta\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: C:\Users\Deeksha Gupta) 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 (C:\Users\Deeksha Gupta\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:305:16)
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:204:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Deeksha Gupta\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Deeksha Gupta
gyp ERR! node -v v6.3.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

Anyone still facing this issue, this might help (at least worked for me, macbook pro, 10.9.5): http://stackoverflow.com/questions/21752172/invalid-deployment-target-for-stdlib-libc-on-osx-10-8

Thanks @JxnGraphix, your solution worked for me!

I had the same issue. The problem was in the user's folder name, that was in Cyrillic. I created new profile and followed this instructions https://github.com/nodejs/node-gyp. It helped me

I solved my problem when I realized that I had an apt-get installed version of nodejs and nvm / npm installed node. Removed the system installed version and created a soft link from nodejs to node and it worked.

I got the same error and I solved by running the following command:
sudo npm install -g node-gyp@3.4.0

Nodejs - v7.2.0
Npm - 4.0.3

Had the same issue and nothing would work. Finally had to go to node 0.10.26 on the pi.

Used NVM instead of direct node install.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
nvm install 0.10.26

On Windows 10 ubuntu bash, installing build-essential using apt-get install build-essential and rerunning npm install solves the problem

I was able to reproduce this problem on OSX 10.11.6 when building a project that had a dependency of "java": "^0.6.0" changing that to "java": ">=0.6.0" worked fine after
installing Java 7 and/or Java 8 SDK.

I have a similar problem, Please tell me, Is this a problem with the node version or something else?
I tried different versions node 4.., 5..., 6.. - not working

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
make: Entering directory /var/www/simple-comm-client.local/fe/node_modules/protractor/node_modules/selenium-webdriver/node_modules/ws/node_modules/utf-8-validate/build' CXX(target) Release/obj.target/validation/src/validation.o In file included from ../src/validation.cc:15:0: ../node_modules/nan/nan.h:261:25: error: redefinition of ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)’ NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) { ^ ../node_modules/nan/nan.h:256:25: error: ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)’ previously declared here NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) { ^ ../node_modules/nan/nan.h:661:13: error: ‘node::smalloc’ has not been declared , node::smalloc::FreeCallback callback ^ ../node_modules/nan/nan.h:661:35: error: expected ‘,’ or ‘...’ before ‘callback’ , node::smalloc::FreeCallback callback ^ ../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’: ../node_modules/nan/nan.h:665:50: error: ‘callback’ was not declared in this scope v8::Isolate::GetCurrent(), data, length, callback, hint); ^ ../node_modules/nan/nan.h:665:60: error: ‘hint’ was not declared in this scope v8::Isolate::GetCurrent(), data, length, callback, hint); ^ ../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’: ../node_modules/nan/nan.h:672:67: error: call of overloaded ‘New(v8::Isolate*, const char*&, uint32_t&)’ is ambiguous return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); ^ ../node_modules/nan/nan.h:672:67: note: candidates are: In file included from ../src/validation.cc:10:0: /home/zhenya/.node-gyp/4.6.1/include/node/node_buffer.h:34:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match> NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, ^ /home/zhenya/.node-gyp/4.6.1/include/node/node_buffer.h:34:40: note: no known conversion for argument 3 from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’ /home/zhenya/.node-gyp/4.6.1/include/node/node_buffer.h:46:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match> NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, ^ /home/zhenya/.node-gyp/4.6.1/include/node/node_buffer.h:46:40: note: no known conversion for argument 2 from ‘const char*’ to ‘char*’ In file included from ../src/validation.cc:15:0: ../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’: ../node_modules/nan/nan.h:676:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’ return node::Buffer::New(v8::Isolate::GetCurrent(), size); ^ ../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’: ../node_modules/nan/nan.h:683:12: error: ‘Use’ is not a member of ‘node::Buffer’ return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); ^ make: *** [Release/obj.target/validation/src/validation.o] Error 1 make: Leaving directory /var/www/simple-comm-client.local/fe/node_modules/protractor/node_modules/selenium-webdriver/node_modules/ws/node_modules/utf-8-validate/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/zhenya/.nvm/versions/node/v4.6.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
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 Linux 3.13.0-101-generic
gyp ERR! command "/home/zhenya/.nvm/versions/node/v4.6.1/bin/node" "/home/zhenya/.nvm/versions/node/v4.6.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/simple-comm-client.local/fe/node_modules/protractor/node_modules/selenium-webdriver/node_modules/ws/node_modules/utf-8-validate
gyp ERR! node -v v4.6.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

bufferutil@1.1.0 install /var/www/simple-comm-client.local/fe/node_modules/protractor/node_modules/selenium-webdriver/node_modules/ws/node_modules/bufferutil
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
make: Entering directory /var/www/simple-comm-client.local/fe/node_modules/protractor/node_modules/selenium-webdriver/node_modules/ws/node_modules/bufferutil/build' CXX(target) Release/obj.target/bufferutil/src/bufferutil.o In file included from ../src/bufferutil.cc:16:0: ../node_modules/nan/nan.h:261:25: error: redefinition of ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)’ NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) { ^ ../node_modules/nan/nan.h:256:25: error: ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)’ previously declared here NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) { ^ ../node_modules/nan/nan.h:661:13: error: ‘node::smalloc’ has not been declared , node::smalloc::FreeCallback callback ^ ../node_modules/nan/nan.h:661:35: error: expected ‘,’ or ‘...’ before ‘callback’ , node::smalloc::FreeCallback callback ^ ../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’: ../node_modules/nan/nan.h:665:50: error: ‘callback’ was not declared in this scope v8::Isolate::GetCurrent(), data, length, callback, hint); ^ ../node_modules/nan/nan.h:665:60: error: ‘hint’ was not declared in this scope v8::Isolate::GetCurrent(), data, length, callback, hint); ^ ../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’: ../node_modules/nan/nan.h:672:67: error: call of overloaded ‘New(v8::Isolate*, const char*&, uint32_t&)’ is ambiguous return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); ^ ../node_modules/nan/nan.h:672:67: note: candidates are: In file included from ../src/bufferutil.cc:10:0: /home/zhenya/.node-gyp/4.6.1/include/node/node_buffer.h:34:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match> NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, ^ /home/zhenya/.node-gyp/4.6.1/include/node/node_buffer.h:34:40: note: no known conversion for argument 3 from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’ /home/zhenya/.node-gyp/4.6.1/include/node/node_buffer.h:46:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match> NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, ^ /home/zhenya/.node-gyp/4.6.1/include/node/node_buffer.h:46:40: note: no known conversion for argument 2 from ‘const char*’ to ‘char*’ In file included from ../src/bufferutil.cc:16:0: ../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’: ../node_modules/nan/nan.h:676:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’ return node::Buffer::New(v8::Isolate::GetCurrent(), size); ^ ../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’: ../node_modules/nan/nan.h:683:12: error: ‘Use’ is not a member of ‘node::Buffer’ return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); ^ make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1 make: Leaving directory /var/www/simple-comm-client.local/fe/node_modules/protractor/node_modules/selenium-webdriver/node_modules/ws/node_modules/bufferutil/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/zhenya/.nvm/versions/node/v4.6.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
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 Linux 3.13.0-101-generic
gyp ERR! command "/home/zhenya/.nvm/versions/node/v4.6.1/bin/node" "/home/zhenya/.nvm/versions/node/v4.6.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/simple-comm-client.local/fe/node_modules/protractor/node_modules/selenium-webdriver/node_modules/ws/node_modules/bufferutil
gyp ERR! node -v v4.6.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate@1.1.0

honestly i didn't read all of the stack traces here but i found in a line of mine, that something did not found the g++ lib. So i installed that and then it works for me.

sudo apt-get install g++

Worked for me

EDIT:
System: "Ubuntu 14.04.5 LTS"
Node: per NVM 4.7.0
NPM: 2.15.11

Here's my case what fixed it:

I used nvm and had 7.2.1 installed.

  1. Removed nvm brew uninstall nvm
  2. Surely remove node, sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
  3. Install node@6.9.2 brew install node@6
    Errors gone!

MAC USERS. @mrmoss and I figured (part of) this out. At least in regards to certain packages that depend on node-gyp.

POSIX definitions are different for GCC and Clang.

If you use gcc an it redirects to clang, then you'll have issues with a lot of packages that use node-gyp. You can get around it by installing GCC with homebrew via brew install gcc (and manually moving the old gcc in /usr/bin and symlinking the new gcc there).

Obviously this could have huge repercussions for other packages and such, but... that might be part of your problem.

I'm not sure this is the same issue. The errors were fairly straight forward for the terminal package we were using:

  CXX(target) Release/obj.target/termios/src/termios.o
../src/termios.cpp:31:10: error: use of undeclared identifier 'B460800'
{460800, B460800},
         ^
../src/termios.cpp:32:10: error: use of undeclared identifier 'B500000'
{500000, B500000},
         ^
../src/termios.cpp:33:10: error: use of undeclared identifier 'B576000'
{576000, B576000},
         ^
../src/termios.cpp:34:10: error: use of undeclared identifier 'B921600'
{921600, B921600},
         ^
../src/termios.cpp:35:11: error: use of undeclared identifier 'B1000000'
{1000000, B1000000},
          ^
../src/termios.cpp:36:11: error: use of undeclared identifier 'B1152000'
{1152000, B1152000},
          ^
../src/termios.cpp:37:11: error: use of undeclared identifier 'B1500000'
{1500000, B1500000},
          ^
../src/termios.cpp:38:11: error: use of undeclared identifier 'B2000000'
{2000000, B2000000},
          ^
../src/termios.cpp:39:11: error: use of undeclared identifier 'B2500000'
{2500000, B2500000},
          ^
../src/termios.cpp:40:11: error: use of undeclared identifier 'B3000000'
{3000000, B3000000},
          ^
../src/termios.cpp:41:11: error: use of undeclared identifier 'B3500000'
{3500000, B3500000},
          ^
../src/termios.cpp:42:11: error: use of undeclared identifier 'B4000000'
{4000000, B4000000},
          ^
../src/termios.cpp:86:18: error: use of undeclared identifier 'CBAUD'
                        t.c_cflag &= ~CBAUD;
                                      ^
../src/termios.cpp:106:38: error: use of undeclared identifier 'CBAUD'
        int baud = mask_to_baud(t.c_cflag & CBAUD);

Upon searching similar macOS errors, this seems to be a known issue between the macOS and GNU headers.

Any one has idea about this error..

gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/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 Linux 2.6.32-642.4.2.el6.x86_64
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 /home/otenro/Otenro/node_modules/lwip
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 2.6.32-642.4.2.el6.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "update"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE

npm ERR! lwip@0.0.9 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lwip@0.0.9 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 lwip 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 lwip
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls lwip
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

I removed .node-gyp and npm update but it didnt work.

@madhurangaonbit It's right there in the error message...

Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Nope everything is working fine in local machine with below config
node -v
v6.9.2
npm -v
3.10.9
Ubuntu 16.10

Issue comes up on Cent Os v6+

Any idea??

Looking at what you posted again, I think you omitted the actual build error; fsevents is just a red herring.

My money is on your system's compiler being too old.

This is still an issue for CentOS 6+ @madhurangaonbit I followed the instructions on this SO post and managed to resolved node-gyp:

http://stackoverflow.com/questions/36327805/how-to-install-gcc-5-3-with-yum-on-centos-7-2

Cheers.

@jasonwr thankz

Problem exist with following configuration as well:
node -v: 7.3.0
npm -v: 4.1.1

macOS Sierra
Version 10.12.2

But it works with node 6.9.2.

@klemenoslaj Could you open a new issue with information about your actual failure (what you ran, what the errors were). Did you follow the dependency installation instructions in the README?

Also did you upgrade your npm version? node v7.3.0 seems to come with npm v3.10.10 by default.

Updating to gcc 5 fixed this for me.

same here when installing zmq (zero mq) JustinTulloss/zeromq.node#586

Having this issue on a 2013 Macbook air running Latest MacOS. I'm specifically trying to install the dependencies for soundcast : https://github.com/andresgottlieb/soundcast/tree/master/archive

@davidawad node-gyp rebuild errors are basically compile errors, and are usually a problem with the package you're trying to compile (if your program doesn't compile, 99% of the time it's not the compiler's fault).

In this case the package you're trying to install has an outdated dependency chromecast-osx-audio v0.2.0, which itself depends on osx-audio v0.2.0. This is broken. Updating to the latest version fixes the issue. Looking at the npm-debug.log (as the error message tells you to do) tells you where the problem occurred, and what to do about it (this is most likely a problem with the osx-audio package, contact the package author etc.).

The package you're trying to install is unmaintained, you'll probably need to at least update the dependencies. Updating chromecast-osx-audio got it to install for me (although you'll probably have other issues getting it to actually run).

diff --git a/archive/package.json b/archive/package.json
index be55cfa..1841dec 100644
--- a/archive/package.json
+++ b/archive/package.json
@@ -8,7 +8,7 @@
     "url": "https://github.com/andresgottlieb/soundcast"
   },
   "dependencies": {
-    "chromecast-osx-audio": "^0.3.0",
+    "chromecast-osx-audio": "^1.0.1",
     "menubar": "2.3.0",
     "shelljs": "0.5.3"
   },

npm-debug.log

22404 verbose stack Error: osx-audio@0.2.0 install: `node-gyp rebuild`
22404 verbose stack Exit status 1
22404 verbose stack     at EventEmitter.<anonymous> (/Users/gib/.nvm/versions/node/v6.10.0/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
22404 verbose stack     at emitTwo (events.js:106:13)
22404 verbose stack     at EventEmitter.emit (events.js:191:7)
22404 verbose stack     at ChildProcess.<anonymous> (/Users/gib/.nvm/versions/node/v6.10.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
22404 verbose stack     at emitTwo (events.js:106:13)
22404 verbose stack     at ChildProcess.emit (events.js:191:7)
22404 verbose stack     at maybeClose (internal/child_process.js:877:16)
22404 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
22405 verbose pkgid osx-audio@0.2.0
22406 verbose cwd /Users/gib/tmp/soundcast/archive
22407 error Darwin 16.4.0
22408 error argv "/Users/gib/.nvm/versions/node/v6.10.0/bin/node" "/Users/gib/.nvm/versions/node/v6.10.0/bin/npm" "i"
22409 error node v6.10.0
22410 error npm  v3.10.10
22411 error code ELIFECYCLE
22412 error osx-audio@0.2.0 install: `node-gyp rebuild`
22412 error Exit status 1
22413 error Failed at the osx-audio@0.2.0 install script 'node-gyp rebuild'.
22413 error Make sure you have the latest version of node.js and npm installed.
22413 error If you do, this is most likely a problem with the osx-audio package,
22413 error not with npm itself.
22413 error Tell the author that this fails on your system:
22413 error     node-gyp rebuild
22413 error You can get information on how to open an issue for this project with:
22413 error     npm bugs osx-audio
22413 error Or if that isn't available, you can get their info via:
22413 error     npm owner ls osx-audio

same here when installing zmq (zero mq) JustinTulloss/zeromq.node#586

@LucasZanella looks like an issue with the module.

wdeer commented

sorry, i didn't read all of the above, but if your .npmrc has a path to python try removing it and running node-gyp rebuild again, this resolved the issue for me.. this was after i ran npm uninstall -g node-gyp && npm install -g node-gyp && rm -rf .node-gyp/ but i think just removing the path in my .npmrc was all that really mattered.

note: i use nodenv with node v6.9.2 / npm v3.10.9

I don't know why but I found a solution and worked for me every time. Just simply install build-essential

sudo apt-get update
sudo apt-get install build-essential

I don't know why but I found a solution and worked for me every time. Just simply install build-essential

@amrendraw3 yep, that should work. See the node-gyp README:

You will also need to install:

  • python (v2.7 recommended, v3.x.x is not supported)
  • make
  • A proper C/C++ compiler toolchain, like GCC

According to its docs, build-essential contains gcc/g++ and make, so if you also have python 2 on the system as well (I think it comes by default in Ubuntu) then you have all the dependencies node-gyp needs.

Using ubuntu 16.02 I fixed the problem by install node using the method listed under "How to Install Using a PPA", rather than just using apt-get install
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04

Using ubuntu 16.02 I fixed the problem by install node using the method listed under "How to Install Using a PPA", rather than just using apt-get install

Yep, that just adds the ppa, does an apt-get install of nodejs and npm, and then does sudo apt-get install build-essential, giving you node, npm, and the required build tools.

'restify-json-body-parser' this package created the issue. After removing it, all went well.

Comment from @ByScripts helped me .. thx

Full installation node-gyp@3.4.0 on Ubuntu 16 with node 4.4.5:

cd my_app

npm init

apt-get install build-essential
apt-get install gcc
apt-get install pkg-config
apt-get install libcairo2-dev # not sure about it
apt-get install libpng-dev # not sure about it
apt-get install libjpeg-dev # not sure about it
apt-get install libgif-dev # not sure about it
apt-get install g++ gyp

wget https://raw.githubusercontent.com/XadillaX/aliyun-ons/master/binding.gyp

npm install node-gyp

I hope it will help somebody

sesan commented

I keep having this error after typing in npm install in my project

> bcrypt@1.0.2 install C:\Users\sesan.osanyinbi\Documents\My Web Sites\vggdev\node_modules\bcrypt
> node-pre-gyp install --fallback-to-build

'node-pre-gyp' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@1.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@1.0.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!     C:\Users\sesan.osanyinbi\AppData\Roaming\npm-cache\_logs\2017-06-28T16_08_03_876Z-debug.log

macOS High Sierra. Problem has appeared on two computers.
Deleted yarn.lock and package-lock.json (not sure that it's necessary)
Deleted /Users/<username>/.atom/.node-gyp then yarn install and at least I am able to run yarn install without errors. Still erroring when yarn add packages.

P.S. You can locate your .node-gyp files with this command find / -name '.node-gyp' 2>/dev/null

My problem started off as a problem with me not having some MySQL library installed, but now I face this:

npm ERR! mysql-libmysqlclient@1.6.0 install: `node-gyp rebuild`
npm ERR! Exit status 1

I've tried most of the fixes that have been suggested up above by others facing similar issues. Following the above advice I did:

rm -rf ~/.node-gyp

This had no effect.

I also deleted the node_modules folder and reinstalled everything. This had no effect.

The background:

using npm@4.2.0
using node@v6.9.3

Running on AWS with Amazon Linux, which is an offshoot of RedHat.

I'm working for a client who has set me up with an EC2 instance where I should do some work. I'd been building an API locally, and now I transferred it to the EC2 instance. I ssh to the server and cd to the directory. I try this:

npm install mysql-libmysqlclient

Initially I got an error about "mysql_config" not being installed. This EC2 instance does not run MySQL and does not have it installed. So I sudo and:

 yum install mysql

That didn't fix the problem, so I kept adding more stuff:

 yum install mysql mysql-server

At some point I got the error "Can't install 'mysql.h' file not found" so I kept adding stuff:

 yum install libmysqlclient-dev
 yum install mysql-devel.noarch   mysql-libs.noarch   mysql-common.noarch   
 yum install -y mysql-devel

Some of the errors seem to do with node-gyp, however, if I do this:

 npm install -g node-gyp

then this installs without a problem.

And yet, if I run npm install mysql-libmysqlclient the make output seems to die with a message about node-gyp:

> mysql-libmysqlclient@1.6.0 install /home/ec2-user/daemons/deduplication_api/v11/dupe-res/node_modules/mysql-libmysqlclient
> node-gyp rebuild

make: Entering directory `/home/ec2-user/daemons/deduplication_api/v11/dupe-res/node_modules/mysql-libmysqlclient/build'
  CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings.o
In file included from ../src/././mysql_bindings.h:14:0,
                 from ../src/./mysql_bindings_connection.h:22,
                 from ../src/mysql_bindings.cc:17:
../../nan/nan.h: In function ‘v8::Handle<v8::Value> NanError(const char*)’:
../../nan/nan.h:319:38: error: ‘New’ is not a member of ‘v8::String’
 # define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
                                      ^
../../nan/nan.h:339:13: note: in expansion of macro ‘_NAN_ERROR’
     return  _NAN_ERROR(v8::Exception::Error, errmsg);
             ^
../../nan/nan.h: In function ‘void NanThrowError(const char*)’:
../../nan/nan.h:324:7: error: ‘ThrowException’ is not a member of ‘v8’
       v8::ThrowException(_NAN_ERROR(fun, errmsg));                             \
       ^
../../nan/nan.h:343:5: note: in expansion of macro ‘_NAN_THROW_ERROR’
     _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
     ^
../../nan/nan.h:319:38: error: ‘New’ is not a member of ‘v8::String’
 # define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
                                      ^
../../nan/nan.h:324:26: note: in expansion of macro ‘_NAN_ERROR’
       v8::ThrowException(_NAN_ERROR(fun, errmsg));                             \
                          ^
../../nan/nan.h:343:5: note: in expansion of macro ‘_NAN_THROW_ERROR’
     _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
     ^
../../nan/nan.h: In function ‘void NanThrowError(v8::Handle<v8::Value>)’:
../../nan/nan.h:348:5: error: ‘ThrowException’ is not a member of ‘v8’
     v8::ThrowException(error);
     ^
../../nan/nan.h: In function ‘v8::Handle<v8::Value> NanError(const char*, int)’:
../../nan/nan.h:355:53: error: ‘New’ is not a member of ‘v8::String’
     v8::Local<v8::Value> err = v8::Exception::Error(v8::String::New(msg));
                                                     ^
../../nan/nan.h:357:14: error: ‘New’ is not a member of ‘v8::String’
     obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber));
              ^
../../nan/nan.h:357:65: error: no matching function for call to ‘v8::Int32::New(const int&)’
     obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber));
                                                                 ^
../../nan/nan.h:357:65: note: candidate is:
In file included from /home/ec2-user/.node-gyp/6.9.3/include/node/node.h:42:0,
                 from ../src/mysql_bindings.cc:12:
/home/ec2-user/.node-gyp/6.9.3/include/node/v8.h:2558:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/ec2-user/.node-gyp/6.9.3/include/node/v8.h:2558:25: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/././mysql_bindings.h:14:0,
                 from ../src/./mysql_bindings_connection.h:22,
                 from ../src/mysql_bindings.cc:17:
../../nan/nan.h: In function ‘v8::Handle<v8::Value> NanTypeError(const char*)’:
../../nan/nan.h:319:38: error: ‘New’ is not a member of ‘v8::String’
 # define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
                                      ^
../../nan/nan.h:369:12: note: in expansion of macro ‘_NAN_ERROR’
     return _NAN_ERROR(v8::Exception::TypeError, errmsg);
            ^
../../nan/nan.h: In function ‘void NanThrowTypeError(const char*)’:
../../nan/nan.h:324:7: error: ‘ThrowException’ is not a member of ‘v8’
       v8::ThrowException(_NAN_ERROR(fun, errmsg));                             \
       ^
../../nan/nan.h:373:5: note: in expansion of macro ‘_NAN_THROW_ERROR’
     _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
     ^
../../nan/nan.h:319:38: error: ‘New’ is not a member of ‘v8::String’
 # define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
                                      ^
../../nan/nan.h:324:26: note: in expansion of macro ‘_NAN_ERROR’
       v8::ThrowException(_NAN_ERROR(fun, errmsg));                             \
                          ^
../../nan/nan.h:373:5: note: in expansion of macro ‘_NAN_THROW_ERROR’
     _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
     ^
../../nan/nan.h: In function ‘v8::Handle<v8::Value> NanRangeError(const char*)’:
../../nan/nan.h:319:38: error: ‘New’ is not a member of ‘v8::String’
 # define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
                                      ^
../../nan/nan.h:377:12: note: in expansion of macro ‘_NAN_ERROR’
     return _NAN_ERROR(v8::Exception::RangeError, errmsg);
            ^
../../nan/nan.h: In function ‘void NanThrowRangeError(const char*)’:
../../nan/nan.h:324:7: error: ‘ThrowException’ is not a member of ‘v8’
       v8::ThrowException(_NAN_ERROR(fun, errmsg));                             \
       ^
../../nan/nan.h:381:5: note: in expansion of macro ‘_NAN_THROW_ERROR’
     _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
     ^
../../nan/nan.h:319:38: error: ‘New’ is not a member of ‘v8::String’
 # define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
                                      ^
../../nan/nan.h:324:26: note: in expansion of macro ‘_NAN_ERROR’
       v8::ThrowException(_NAN_ERROR(fun, errmsg));                             \
                          ^
../../nan/nan.h:381:5: note: in expansion of macro ‘_NAN_THROW_ERROR’
     _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
     ^
../../nan/nan.h: At global scope:
../../nan/nan.h:406:13: error: ‘node::smalloc’ has not been declared
     , node::smalloc::FreeCallback callback
             ^
../../nan/nan.h:141:71: note: in definition of macro ‘NAN_INLINE’
 # define NAN_INLINE(declarator) inline __attribute__((always_inline)) declarator
                                                                       ^
../../nan/nan.h:406:35: error: expected ‘,’ or ‘...’ before ‘callback’
     , node::smalloc::FreeCallback callback
                                   ^
../../nan/nan.h:141:71: note: in definition of macro ‘NAN_INLINE’
 # define NAN_INLINE(declarator) inline __attribute__((always_inline)) declarator
                                                                       ^
../../nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’:
../../nan/nan.h:409:44: error: ‘callback’ was not declared in this scope
     return node::Buffer::New(data, length, callback, hint);
                                            ^
../../nan/nan.h:409:54: error: ‘hint’ was not declared in this scope
     return node::Buffer::New(data, length, callback, hint);
                                                      ^
../../nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, uint32_t)’:
../../nan/nan.h:416:40: error: no matching function for call to ‘New(char*&, uint32_t&)’
     return node::Buffer::New(data, size);
                                        ^
../../nan/nan.h:416:40: note: candidates are:
In file included from ../src/././mysql_bindings.h:12:0,
                 from ../src/./mysql_bindings_connection.h:22,
                 from ../src/mysql_bindings.cc:17:
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, size_t)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:31:40: note:   no known conversion for argument 1 from ‘char*’ to ‘v8::Isolate*’
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:34:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:34:40: note:   no known conversion for argument 1 from ‘char*’ to ‘v8::Isolate*’
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:39:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t, node::Buffer::FreeCallback, void*)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:39:40: note:   candidate expects 5 arguments, 2 provided
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:46:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:46:40: note:   candidate expects 3 arguments, 2 provided
In file included from ../src/././mysql_bindings.h:14:0,
                 from ../src/./mysql_bindings_connection.h:22,
                 from ../src/mysql_bindings.cc:17:
../../nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../../nan/nan.h:420:34: error: no matching function for call to ‘New(uint32_t&)’
     return node::Buffer::New(size);
                                  ^
../../nan/nan.h:420:34: note: candidates are:
In file included from ../src/././mysql_bindings.h:12:0,
                 from ../src/./mysql_bindings_connection.h:22,
                 from ../src/mysql_bindings.cc:17:
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, size_t)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:31:40: note:   candidate expects 2 arguments, 1 provided
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:34:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:34:40: note:   candidate expects 3 arguments, 1 provided
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:39:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t, node::Buffer::FreeCallback, void*)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:39:40: note:   candidate expects 5 arguments, 1 provided
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:46:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/node_buffer.h:46:40: note:   candidate expects 3 arguments, 1 provided
In file included from ../src/././mysql_bindings.h:14:0,
                 from ../src/./mysql_bindings_connection.h:22,
                 from ../src/mysql_bindings.cc:17:
../../nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’:
../../nan/nan.h:427:12: error: ‘Use’ is not a member of ‘node::Buffer’
     return node::Buffer::Use(data, size);
            ^
../../nan/nan.h: In constructor ‘NanCallback::NanCallback()’:
../../nan/nan.h:727:49: error: no matching function for call to ‘v8::Object::New()’
     v8::Local<v8::Object> obj = v8::Object::New();
                                                 ^
../../nan/nan.h:727:49: note: candidate is:
In file included from /home/ec2-user/.node-gyp/6.9.3/include/node/node.h:42:0,
                 from ../src/mysql_bindings.cc:12:
/home/ec2-user/.node-gyp/6.9.3/include/node/v8.h:3006:24: note: static v8::Local<v8::Object> v8::Object::New(v8::Isolate*)
   static Local<Object> New(Isolate* isolate);
                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/v8.h:3006:24: note:   candidate expects 1 argument, 0 provided
In file included from ../src/././mysql_bindings.h:14:0,
                 from ../src/./mysql_bindings_connection.h:22,
                 from ../src/mysql_bindings.cc:17:
../../nan/nan.h: In constructor ‘NanCallback::NanCallback(v8::Handle<v8::Function>&)’:
../../nan/nan.h:733:49: error: no matching function for call to ‘v8::Object::New()’
     v8::Local<v8::Object> obj = v8::Object::New();
                                                 ^
../../nan/nan.h:733:49: note: candidate is:
In file included from /home/ec2-user/.node-gyp/6.9.3/include/node/node.h:42:0,
                 from ../src/mysql_bindings.cc:12:
/home/ec2-user/.node-gyp/6.9.3/include/node/v8.h:3006:24: note: static v8::Local<v8::Object> v8::Object::New(v8::Isolate*)
   static Local<Object> New(Isolate* isolate);
                        ^
/home/ec2-user/.node-gyp/6.9.3/include/node/v8.h:3006:24: note:   candidate expects 1 argument, 0 provided
In file included from ../src/././mysql_bindings.h:14:0,
                 from ../src/./mysql_bindings_connection.h:22,
                 from ../src/mysql_bindings.cc:17:
../../nan/nan.h: In destructor ‘NanCallback::~NanCallback()’:
../../nan/nan.h:740:12: error: ‘class v8::Persistent<v8::Object>’ has no member named ‘Dispose’
     handle.Dispose();
            ^
../../nan/nan.h:741:12: error: ‘class v8::Persistent<v8::Object>’ has no member named ‘Clear’
     handle.Clear();
            ^
../../nan/nan.h: In member function ‘void NanCallback::SetFunction(v8::Handle<v8::Function>&)’:
../../nan/nan.h:181:26: error: ‘NewSymbol’ is not a member of ‘v8::String’
 #define NanSymbol(value) v8::String::NewSymbol(value)
                          ^
../../nan/nan.h:746:39: note: in expansion of macro ‘NanSymbol’
     NanPersistentToLocal(handle)->Set(NanSymbol("callback"), fn);
                                       ^
../../nan/nan.h: In member function ‘v8::Local<v8::Function> NanCallback::GetFunction()’:
../../nan/nan.h:181:26: error: ‘NewSymbol’ is not a member of ‘v8::String’
 #define NanSymbol(value) v8::String::NewSymbol(value)
                          ^
../../nan/nan.h:750:46: note: in expansion of macro ‘NanSymbol’
     return NanPersistentToLocal(handle)->Get(NanSymbol("callback"))
                                              ^
../../nan/nan.h:751:25: error: expected primary-expression before ‘>’ token
         .As<v8::Function>();
                         ^
../../nan/nan.h:751:27: error: expected primary-expression before ‘)’ token
         .As<v8::Function>();
                           ^
../../nan/nan.h: In member function ‘void NanCallback::Call(int, v8::Handle<v8::Value>*)’:
../../nan/nan.h:181:26: error: ‘NewSymbol’ is not a member of ‘v8::String’
 #define NanSymbol(value) v8::String::NewSymbol(value)
                          ^
../../nan/nan.h:759:13: note: in expansion of macro ‘NanSymbol’
         Get(NanSymbol("callback")).As<v8::Function>();
             ^
../../nan/nan.h:759:51: error: expected primary-expression before ‘>’ token
         Get(NanSymbol("callback")).As<v8::Function>();
                                                   ^
../../nan/nan.h:759:53: error: expected primary-expression before ‘)’ token
         Get(NanSymbol("callback")).As<v8::Function>();
                                                     ^
../../nan/nan.h:761:9: error: ‘GetCurrent’ is not a member of ‘v8::Context’
         v8::Context::GetCurrent()->Global()
         ^
../../nan/nan.h: In member function ‘void NanAsyncWorker::SavePersistent(const char*, v8::Local<v8::Object>&)’:
../../nan/nan.h:181:26: error: ‘NewSymbol’ is not a member of ‘v8::String’
 #define NanSymbol(value) v8::String::NewSymbol(value)
                          ^
../../nan/nan.h:808:17: note: in expansion of macro ‘NanSymbol’
     handle->Set(NanSymbol(key), obj);
                 ^
../../nan/nan.h: In member function ‘v8::Local<v8::Object> NanAsyncWorker::GetFromPersistent(const char*)’:
../../nan/nan.h:181:26: error: ‘NewSymbol’ is not a member of ‘v8::String’
 #define NanSymbol(value) v8::String::NewSymbol(value)
                          ^
../../nan/nan.h:815:24: note: in expansion of macro ‘NanSymbol’
     return handle->Get(NanSymbol(key)).As<v8::Object>();
                        ^
../../nan/nan.h:815:53: error: expected primary-expression before ‘>’ token
     return handle->Get(NanSymbol(key)).As<v8::Object>();
                                                     ^
../../nan/nan.h:815:55: error: expected primary-expression before ‘)’ token
     return handle->Get(NanSymbol(key)).As<v8::Object>();
                                                       ^
../../nan/nan.h: In member function ‘virtual void NanAsyncWorker::HandleErrorCallback()’:
../../nan/nan.h:837:30: error: ‘New’ is not a member of ‘v8::String’
         v8::Exception::Error(v8::String::New(errmsg))
                              ^
../../nan/nan.h: In function ‘bool _NanGetExternalParts(v8::Handle<v8::Value>, const char**, size_t*)’:
../../nan/nan.h:1005:12: error: ‘class v8::String’ has no member named ‘IsExternalAscii’
   if (str->IsExternalAscii()) {
            ^
../../nan/nan.h:1006:11: error: ‘ExternalAsciiStringResource’ in ‘class v8::String’ does not name a type
     const v8::String::ExternalAsciiStringResource* ext;
           ^
../../nan/nan.h:1007:5: error: ‘ext’ was not declared in this scope
     ext = str->GetExternalAsciiStringResource();
     ^
../../nan/nan.h:1007:16: error: ‘class v8::String’ has no member named ‘GetExternalAsciiStringResource’
     ext = str->GetExternalAsciiStringResource();
                ^
../../nan/nan.h: In instantiation of ‘void NanDisposePersistent(v8::Persistent<T, v8::NonCopyablePersistentTraits<T> >&) [with T = v8::Object]’:
../../nan/nan.h:786:44:   required from here
../../nan/nan.h:394:5: error: ‘class v8::Persistent<v8::Object>’ has no member named ‘Clear’
     handle.Clear();
     ^
make: *** [Release/obj.target/mysql_bindings/src/mysql_bindings.o] Error 1
make: Leaving directory `/home/ec2-user/daemons/deduplication_api/v11/dupe-res/node_modules/mysql-libmysqlclient/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/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 Linux 4.4.41-36.55.amzn1.x86_64
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 /home/ec2-user/daemons/deduplication_api/v11/dupe-res/node_modules/mysql-libmysqlclient
gyp ERR! node -v v6.9.3
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok 
npm ERR! Linux 4.4.41-36.55.amzn1.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "mysql-libmysqlclient"
npm ERR! node v6.9.3
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! mysql-libmysqlclient@1.6.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mysql-libmysqlclient@1.6.0 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 mysql-libmysqlclient 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 mysql-libmysqlclient
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls mysql-libmysqlclient
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ec2-user/.npm/_logs/2017-07-27T22_29_14_226Z-debug.log

To be sure I had some kind of compiler, I also did:

 yum install gcc

But it said it was already installed.

@lkrubner That module appears to be unmaintained, it was last updated in 2014. The compile errors indicate it was written for an old version of the Node.js/V8 API.

edit: from https://www.npmjs.com/package/mysql-libmysqlclient

This module has been tested with Node.js versions 0.8.26, v0.10.25 and 0.11.10

@bnoordhuis -- thank you for that. I'll find some other road forward.

fc commented

Upgrading nvm worked for me although I did a number of other things before this that may have helped (removing node-gyp folder for example)... it immediately worked after the nvm upgrade within the same shell terminal.

Seems Ubuntu 16.04 does NOT come with python 2.7 preinstalled. Server was running fine until I tried to run npm install yesterday and have been seeing errors and have been unable to build since.

below seems to be the problem,

ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:449:14)
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:353:11
gyp ERR! stack     at F (/usr/lib/node_modules/npm/node_modules/which/which.js:69:16)
gyp ERR! stack     at E (/usr/lib/node_modules/npm/node_modules/which/which.js:81:29)
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/which.js:90:16
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Linux 4.4.0-1013-aws
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/app/client/releases/20170927125424/node_modules/inotify
gyp ERR! node -v v6.11.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm ERR! Linux 4.4.0-1013-aws
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--production"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! inotify@1.4.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the inotify@1.4.2 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 inotify 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 inotify
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls inotify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/app/client/releases/20170927125424/npm-debug.log

fc commented

@kodepareek have you tried installing python...?

@kodepareek sudo apt-get install python

@fc have installed python now and exported python pointing to the executable. npm install worked fine. Just wanted to let it be known as an issue, I think node-gyp is depending on python 2.7 being part of the system but ubuntu 16.10++ does not have that installed by default.

@kodepareek that's correct, Python 2 is listed as a dependency in the README: https://github.com/nodejs/node-gyp/#on-unix

There are plans to try to remove this requirement, but as upstream GYP is basically deprecated at this point, it's difficult to do.

@gibfahn Just read up about GYP and understood what you mean. Well its a headscratcher. Especially because I wasn't using node-gyp but npm and could not build or install dependencies. Hopefully your suggestions above will help out someone sometime.

In WSL when installing dependencies with yarn that also depend/build sharp:

Error: Can't find Python executable "C:Python27python.exe", you can set the PYTHON env variable.

I wasn't using node-gyp but npm and could not build or install dependencies. Hopefully your suggestions above will help out someone sometime.

@kodepareek When you npm install a native module (one with C++ as well as JavaScript code), GYP is used to generate the platform-specific makefile for the module, which is then compiled. So npm install of a native module will compile that module (unless the developer has included prebuilt binaries).

In WSL when installing dependencies with yarn that also depend/build sharp:

@strarsis is that a question? You need to have Python 2.7 to npm install a native module, install it with sudo apt install python on Ubuntu.