Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Error running npm install #1159

Closed
MSaifAsif opened this issue Jan 23, 2016 · 13 comments
Closed

Error running npm install #1159

MSaifAsif opened this issue Jan 23, 2016 · 13 comments
Assignees

Comments

@MSaifAsif
Copy link

Hello,
I am facing an error when trying to run npm install. My environment is as below
node v5.5.0
npm 3.5.3

I installed node and npm using https://gist.github.com/isaacs/579814

Attaching error below

mean@mean-VirtualBox:~/projects/rastay/rastay-api-backend$ npm install

> v8-debug@0.4.6 preinstall /home/mean/projects/rastay/rastay-api-backend/node_modules/.staging/v8-debug-dc089d8b
>  

npm WARN prefer global node-gyp@3.2.1 should be installed with -g
npm WARN prefer global node-inspector@0.10.2 should be installed with -g

> bufferutil@1.1.0 install /home/mean/projects/rastay/rastay-api-backend/node_modules/bufferutil
> node-gyp rebuild

make: Entering directory '/home/mean/projects/rastay/rastay-api-backend/node_modules/bufferutil/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
In file included from ../src/bufferutil.cc:16:0:
../../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) {
                         ^
../../nan/nan.h:256:25: note: ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)’ previously declared here
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                         ^
../../nan/nan.h:661:13: error: ‘node::smalloc’ has not been declared
     , node::smalloc::FreeCallback callback
             ^
../../nan/nan.h:661:35: error: expected ‘,’ or ‘...’ before ‘callback’
     , node::smalloc::FreeCallback callback
                                   ^
../../nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’:
../../nan/nan.h:665:50: error: ‘callback’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                  ^
../../nan/nan.h:665:60: error: ‘hint’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                            ^
../../nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’:
../../nan/nan.h:672:67: error: no matching function for call to ‘New(v8::Isolate*, const char*&, uint32_t&)’
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
In file included from ../src/bufferutil.cc:10:0:
/home/mean/.node-gyp/5.5.0/include/node/node_buffer.h:31:40: note: candidate: 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/mean/.node-gyp/5.5.0/include/node/node_buffer.h:31:40: note:   conversion of argument 3 would be ill-formed:
In file included from ../src/bufferutil.cc:16:0:
../../nan/nan.h:672:67: error: invalid conversion from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’ [-fpermissive]
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
In file included from ../src/bufferutil.cc:10:0:
/home/mean/.node-gyp/5.5.0/include/node/node_buffer.h:43:40: note: candidate: 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/mean/.node-gyp/5.5.0/include/node/node_buffer.h:43:40: note:   conversion of argument 2 would be ill-formed:
In file included from ../src/bufferutil.cc:16:0:
../../nan/nan.h:672:67: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
../../nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../../nan/nan.h:676:29: 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);
                             ^
../../nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’:
../../nan/nan.h:683:12: error: ‘Use’ is not a member of ‘node::Buffer’
     return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
            ^
bufferutil.target.mk:92: recipe for target 'Release/obj.target/bufferutil/src/bufferutil.o' failed
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
make: Leaving directory '/home/mean/projects/rastay/rastay-api-backend/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/mean/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.2.0-16-generic
gyp ERR! command "/home/mean/local/bin/node" "/home/mean/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/mean/projects/rastay/rastay-api-backend/node_modules/bufferutil
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok 
npm WARN install:bufferutil@1.1.0 bufferutil@1.1.0 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.1.0 Exit status 1

Any help would be appreciated !

@ilanbiala
Copy link
Member

We don't support Node 5 yet, please try with Node 4.

@MSaifAsif
Copy link
Author

Thanks for the reply, let me try it out

@MSaifAsif
Copy link
Author

No luck, still getting the error. (updated to node v4.2.6)

mean@mean-VirtualBox:~/projects/rastay/rastay-api-backend$ npm install
|
> v8-debug@0.4.6 preinstall /home/mean/projects/rastay/rastay-api-backend/node_modules/grunt-node-inspector/node_modules/node-inspector/node_modules/v8-debug
>  

-
> utf-8-validate@1.1.0 install /home/mean/projects/rastay/rastay-api-backend/node_modules/grunt-node-inspector/node_modules/node-inspector/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

make: Entering directory '/home/mean/projects/rastay/rastay-api-backend/node_modules/grunt-node-inspector/node_modules/node-inspector/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: note: ‘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: no matching function for call to ‘New(v8::Isolate*, const char*&, uint32_t&)’
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
In file included from ../src/validation.cc:10:0:
/home/mean/.node-gyp/4.2.6/include/node/node_buffer.h:31:40: note: candidate: 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/mean/.node-gyp/4.2.6/include/node/node_buffer.h:31:40: note:   conversion of argument 3 would be ill-formed:
In file included from ../src/validation.cc:15:0:
../node_modules/nan/nan.h:672:67: error: invalid conversion from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’ [-fpermissive]
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
In file included from ../src/validation.cc:10:0:
/home/mean/.node-gyp/4.2.6/include/node/node_buffer.h:43:40: note: candidate: 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/mean/.node-gyp/4.2.6/include/node/node_buffer.h:43:40: note:   conversion of argument 2 would be ill-formed:
In file included from ../src/validation.cc:15:0:
../node_modules/nan/nan.h:672:67: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:676:29: 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);
            ^
validation.target.mk:92: recipe for target 'Release/obj.target/validation/src/validation.o' failed
make: *** [Release/obj.target/validation/src/validation.o] Error 1
make: Leaving directory '/home/mean/projects/rastay/rastay-api-backend/node_modules/grunt-node-inspector/node_modules/node-inspector/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/mean/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 Linux 4.2.0-16-generic
gyp ERR! command "/home/mean/local/bin/node" "/home/mean/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/mean/projects/rastay/rastay-api-backend/node_modules/grunt-node-inspector/node_modules/node-inspector/node_modules/ws/node_modules/utf-8-validate
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 

@mg1075
Copy link

mg1075 commented Jan 23, 2016

@MSaifAsif - Are you running on a Windows machine?

Perhaps your problem is the one detailed in this epic open issue on the node-gyp repo appropriately entitled:
Windows users are not happy.
nodejs/node-gyp#629

Read the instructions here:
nodejs/node-gyp#629 (comment)

Note: my own experience here is the node-gyp issue did not resolve until installing Visual Studio 2015 and including the C++ options during install.

@MSaifAsif
Copy link
Author

@mg1075 Yeah I happened to come across that issue when google searching for this. But am actually on a linux machine (Ubuntu 14.04 to be exact).
Would this issue have anything to do with the g++ compiler ? Just guessing, since all the issues are C related errors

../node_modules/nan/nan.h:261:25: error: redefinition oftemplate<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: note: ‘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::smallochas not been declared
     , node::smalloc::FreeCallback callback
             ^
../node_modules/nan/nan.h:661:35: error: expected ‘,’ or ‘...’ beforecallback’
     , node::smalloc::FreeCallback callback
                                   ^
../node_modules/nan/nan.h: In functionv8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’:
../node_modules/nan/nan.h:665:50: error: ‘callbackwas not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                  ^
../node_modules/nan/nan.h:665:60: error: ‘hintwas not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                            ^
../node_modules/nan/nan.h: In functionv8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’:
../node_modules/nan/nan.h:672:67: error: no matching function for call toNew(v8::Isolate*, const char*&, uint32_t&)’
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
In file included from ../node_modules/nan/nan.h:25:0,
                 from ../src/debug.cc:2:
/home/mean/.node-gyp/4.2.6/include/node/node_buffer.h:31:40: note: candidate: 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/mean/.node-gyp/4.2.6/include/node/node_buffer.h:31:40: note:   conversion of argument 3 would be ill-formed:
In file included from ../src/debug.cc:2:0:
../node_modules/nan/nan.h:672:67: error: invalid conversion fromuint32_t {aka unsigned int}’ tonode::encoding’ [-fpermissive]
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
In file included from ../node_modules/nan/nan.h:25:0,
                 from ../src/debug.cc:2:
/home/mean/.node-gyp/4.2.6/include/node/node_buffer.h:43:40: note: candidate: 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/mean/.node-gyp/4.2.6/include/node/node_buffer.h:43:40: note:   conversion of argument 2 would be ill-formed:
In file included from ../src/debug.cc:2:0:
../node_modules/nan/nan.h:672:67: error: invalid conversion fromconst char*tochar*’ [-fpermissive]
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
../node_modules/nan/nan.h: In functionv8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:676:29: error: could not convertnode::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ fromv8::MaybeLocal<v8::Object>tov8::Local<v8::Object>return node::Buffer::New(v8::Isolate::GetCurrent(), size);
                             ^
../node_modules/nan/nan.h: In functionv8::Local<v8::Object> NanBufferUse(char*, uint32_t)’:
../node_modules/nan/nan.h:683:12: error: ‘Useis not a member ofnode::Bufferreturn node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);

My system shows the following configs for g++

mean@mean-VirtualBox:~$ g++ --version
g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@trainerbill
Copy link
Contributor

@MSaifAsif I build fine on 4.2.6. I am also on Ubuntu 14.04. do you have build_essentials installed via apt-get? Also do rm -rf node_modules, npm cache clean, and try npm install again.

@weilah
Copy link

weilah commented Jan 27, 2016

I'm experimenting exactly the same error. I also have
node v5.5.0
npm 3.5.3

and installed node following this instructions http://www.johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/
I think they are pretty the same. The one and only difference is that I'm on OS X.

I'm going to try what @trainerbill says and report back

@weilah
Copy link

weilah commented Jan 27, 2016

I ended downgrading the node to 0.12.9 and it worked.

I did it following this steps:

http://apple.stackexchange.com/questions/171530/how-do-i-downgrade-node-or-install-a-specific-previous-version-using-homebrew

@trainerbill
Copy link
Contributor

@weilah You should look into using nvm. Its a lifesafer

@MSaifAsif
Copy link
Author

Ended up downgrading and then followed what @trainerbill suggested. Builds fine now.

@danwdart
Copy link

danwdart commented Aug 9, 2016

So how might this work with node 6.3?I thought there were solutions out there for this...

@ilanbiala
Copy link
Member

@dandart please open a new issue as this was not for Node 6.3.

@jtakalai
Copy link

jtakalai commented Mar 1, 2017

Using 0.12.18 worked. As easy as nvm install 0.12.18. NVM saves the day!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants