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

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

Open brascosDad opened this issue 11 years ago • 251 comments

ernestscomputer:musicomp ernest son$ npm install

> [email protected] 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:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1

> [email protected] 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:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1

brascosDad avatar Nov 09 '15 02:11 brascosDad

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

taylorstine avatar Apr 17 '17 17:04 taylorstine

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.

gibfahn avatar Apr 17 '17 18:04 gibfahn

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

ronak-itility avatar May 15 '17 13:05 ronak-itility

Comment from @ByScripts helped me .. thx

junajan avatar May 17 '17 19:05 junajan

Full installation [email protected] 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

itsNikolay avatar Jun 16 '17 16:06 itsNikolay

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

> [email protected] 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! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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

sesan avatar Jun 28 '17 14:06 sesan

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

nikolaevigor avatar Jul 10 '17 20:07 nikolaevigor

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

npm ERR! [email protected] 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 [email protected] using [email protected]

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:

> [email protected] 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! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the 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 avatar Jul 27 '17 22:07 lkrubner

@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 avatar Jul 28 '17 08:07 bnoordhuis

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

lkrubner avatar Jul 28 '17 18:07 lkrubner

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.

fc avatar Aug 02 '17 20:08 fc

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! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the 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

kodepareek avatar Sep 28 '17 10:09 kodepareek

@kodepareek have you tried installing python...?

fc avatar Sep 28 '17 21:09 fc

@kodepareek sudo apt-get install python

gibfahn avatar Sep 29 '17 06:09 gibfahn

@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 avatar Sep 29 '17 07:09 kodepareek

@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 avatar Sep 29 '17 07:09 gibfahn

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

kodepareek avatar Sep 29 '17 08:09 kodepareek

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.

strarsis avatar Sep 29 '17 13:09 strarsis

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

gibfahn avatar Sep 29 '17 15:09 gibfahn

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.

gibfahn avatar Sep 29 '17 15:09 gibfahn