pty.js icon indicating copy to clipboard operation
pty.js copied to clipboard

Unable to install Node 4.1.1 - node-gyp rebuild fails

Open Clechay opened this issue 9 years ago • 16 comments

I am using Centos 7 and NodeJS 4.1.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! This is most likely a problem with the pty.js package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls pty.js npm ERR! There is likely additional logging output above.

Clechay avatar Sep 27 '15 23:09 Clechay

I tried to install term2 inside the Atom editor, and I think I stumbled upon the same error:

> [email protected] install /tmp/apm-install-dir-1151018-12697-qiz4rd/node_modules/term2/node_modules/pty.js
> node-gyp rebuild

make: Entering directory     '/tmp/apm-install-dir-1151018-12697-qiz4rd/node_modules/term2/node_modules/pty.js/build'
  CXX(target) Release/obj.target/pty/src/unix/pty.o
pty.target.mk:88: recipe for target 'Release/obj.target/pty/src/unix/pty.o' failed
make: Leaving directory     '/tmp/apm-install-dir-1151018-12697-qiz4rd/node_modules/term2/node_modules/pty.js/build'

In file included from ../src/unix/pty.cc:20:0:
../node_modules/nan/nan.h:324:27: error: redefinition of 'template<class T> v8::Local<T>     Nan::imp::NanEnsureHandleOrPersistent(const v8::Local<T>&)'
   NAN_INLINE v8::Local<T> NanEnsureHandleOrPersistent(const v8::Local<T> &val) {
                           ^
../node_modules/nan/nan.h:319:17: note: 'template<class T> v8::Handle<T>     Nan::imp::NanEnsureHandleOrPersistent(v8::Handle<T>&)' previously declared here
   v8::Handle<T> NanEnsureHandleOrPersistent(const v8::Handle<T> &val) {
                 ^
../node_modules/nan/nan.h:344:27: error: redefinition of 'template<class T> v8::Local<T>     Nan::imp::NanEnsureLocal(v8::Handle<T>&)'
   NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Handle<T> &val) {
                           ^
../node_modules/nan/nan.h:334:27: note: 'template<class T> v8::Local<T> Nan::imp::NanEnsureLocal(const     v8::Local<T>&)' previously declared here
   NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Local<T> &val) {
                           ^
../node_modules/nan/nan.h:757:13: error: 'node::smalloc' has not been declared
     , node::smalloc::FreeCallback callback
             ^
../node_modules/nan/nan.h:757: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:761:50: error: 'callback' was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                  ^
../node_modules/nan/nan.h:761: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:768: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 ../node_modules/nan/nan.h:25:0,
                 from ../src/unix/pty.cc:20:
/home/dario/.dotfiles/atom/.node-gyp/.node-gyp/0.34.0/src/node_buffer.h:41: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/dario/.dotfiles/atom/.node-gyp/.node-gyp/0.34.0/src/node_buffer.h:41:40: note:   conversion of     argument 3 would be ill-formed:
In file included from ../src/unix/pty.cc:20:0:
../node_modules/nan/nan.h:768: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 ../node_modules/nan/nan.h:25:0,
                 from ../src/unix/pty.cc:20:
/home/dario/.dotfiles/atom/.node-gyp/.node-gyp/0.34.0/src/node_buffer.h:53: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/dario/.dotfiles/atom/.node-gyp/.node-gyp/0.34.0/src/node_buffer.h:53:40: note:   conversion of     argument 2 would be ill-formed:
In file included from ../src/unix/pty.cc:20:0:
../node_modules/nan/nan.h:768: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:772: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:779:12: error: 'Use' is not a member of 'node::Buffer'
     return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
            ^
../src/unix/pty.cc: In function 'void PtyFork(const v8::FunctionCallbackInfo<v8::Value>&)':
../src/unix/pty.cc:227:34: warning: ignoring return value of 'int chdir(const char*)', declared with     attribute warn_unused_result [-Wunused-result]
       if (strlen(cwd)) chdir(cwd);
                                  ^
make: *** [Release/obj.target/pty/src/unix/pty.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit     (/usr/share/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.14.0
gyp ERR! command "node"     "/usr/share/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/apm-install-dir-1151018-12697-qiz4rd/node_modules/term2/node_modules/pty.js
gyp ERR! node -v v0.10.40
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok 
npm ERR! Linux 3.14.0
npm ERR! argv "/usr/share/atom/resources/app/apm/bin/node"     "/usr/share/atom/resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig"     "/home/dario/.dotfiles/atom/.apm/.apmrc" "--userconfig" "/home/dario/.dotfiles/atom/.apmrc" "install"     "/tmp/d-1151018-12697-jg7j6u/package.tgz" "--target=0.34.0" "--arch=x64"
npm ERR! node v0.10.40
npm ERR! npm  v2.13.3
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! This is most likely a problem with the pty.js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls pty.js
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/apm-install-dir-1151018-12697-qiz4rd/npm-debug.log

Unfortunately, /tmp/apm-install-dir-1151018-12697-qiz4rd/ does not exists (!?) This happens inside a Ubuntu 15.10 chroot (a quite minimal environment, so it's likely that some implicit dependency is missing)

berdario avatar Nov 18 '15 13:11 berdario

@TooTallNate Any update on this?

make: Entering directory '/home/loco/altair/node_modules/pty.js/build'
  CXX(target) Release/obj.target/pty/src/unix/pty.o
../src/unix/pty.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE PtyFork(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/unix/pty.cc:222:34: warning: ignoring return value of ‘int chdir(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
       if (strlen(cwd)) chdir(cwd);
                                  ^
  SOLINK_MODULE(target) Release/obj.target/pty.node
  COPY Release/pty.node

dolftax avatar Nov 20 '15 13:11 dolftax

Same error on Ubuntu 14.04 npm ERR! Linux 3.13.0-63-generic npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "i" npm ERR! node v5.3.0 npm ERR! npm v3.5.2

sunxfancy avatar Jan 03 '16 09:01 sunxfancy

@sunxfancy @berdario Any update on this?

dolftax avatar Jan 14 '16 17:01 dolftax

Oh, after updating the version, this error has been fixed!

sunxfancy avatar Jan 15 '16 00:01 sunxfancy

@sunxfancy Which version? Node (or) this module?

dolftax avatar Jan 15 '16 03:01 dolftax

@dolftax I used the low version of pty.js, now it's bug has been fixed.

sunxfancy avatar Jan 15 '16 05:01 sunxfancy

I still get this error

jmls avatar Feb 03 '16 21:02 jmls

I also am still getting this error:

npm ERR! node v5.4.1 npm ERR! npm v3.3.12 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'.

spiralgen avatar Feb 04 '16 02:02 spiralgen

@jmls @spiralgen This is happening because some of the module you use is still dependent on [email protected]

Look at this : npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.

Ask the module owner to fix it.

dolftax avatar Feb 04 '16 08:02 dolftax

well, something is odd then .. this is what I have in my console:

> [email protected] install /var/myApp/node_modules/tty.js/node_modules/pty.js
> node-gyp rebuild

make: Entering directory '/var/myApp/node_modules/tty.js/node_modules/pty.js/build'
  CXX(target) Release/obj.target/pty/src/unix/pty.o
../src/unix/pty.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE PtyFork(Nan::NAN_METHOD_ARGS_TYPE)':
../src/unix/pty.cc:222:34: warning: ignoring return value of 'int chdir(const char*)', declared with attribute warn_unused_result [-Wunused-result]
       if (strlen(cwd)) chdir(cwd);

it definitely says " [email protected] " ...

jmls avatar Feb 04 '16 09:02 jmls

I get this error as well when running npm install inside a git hook (remote). When running npm install manually, it doesn't happen. Any clue as to why this happens, would be helpful!

ramseydsilva avatar Feb 04 '16 10:02 ramseydsilva

@ramseydsilva Could you post the npm-debug.log file?

dolftax avatar Feb 06 '16 09:02 dolftax

@dolftax Nevermind, I was using the wrong (global) npm executable, when I should have been using the one for my project! When I caught my stupidity, the problem went away. Thanks.

ramseydsilva avatar Feb 19 '16 06:02 ramseydsilva

@dolftax @chjj @jeremyramin I get this error when running apm install terminal-plus. Error log is as follows:

$ git clone https://github.com/chjj/pty.js
$ npm install
$ node-gyp configure rebuild --target="0.37.8" --target_platform=linux --dist-url="https://atom.io/download/atom-shell"
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp http GET https://atom.io/download/atom-shell/v0.37.8/node-v0.37.8.tar.gz
gyp http 200 https://atom.io/download/atom-shell/v0.37.8/node-v0.37.8.tar.gz
gyp info spawn python
gyp info spawn args [ '/usr/bin/gyp',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/xxx/usr/share/pty.js/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/xxx/.node-gyp/0.37.8/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/xxx/.node-gyp/0.37.8',
gyp info spawn args   '-Dmodule_root_dir=/home/xxx/usr/share/pty.js',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn python
gyp info spawn args [ '/usr/bin/gyp',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/xxx/usr/share/pty.js/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/xxx/.node-gyp/0.37.8/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/xxx/.node-gyp/0.37.8',
gyp info spawn args   '-Dmodule_root_dir=/home/xxx/usr/share/pty.js',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/xxx/usr/share/pty.js/build'
  CXX(target) Release/obj.target/pty/src/unix/pty.o
In file included from ../src/unix/pty.cc:20:0:
../node_modules/nan/nan.h:590:20: error: variable or field ‘AddGCEpilogueCallback’ declared void
       v8::Isolate::GCEpilogueCallback callback
                    ^
../node_modules/nan/nan.h:590:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
       v8::Isolate::GCEpilogueCallback callback
       ^
../node_modules/nan/nan.h:591:18: error: expected primary-expression before ‘gc_type_filter’
     , v8::GCType gc_type_filter = v8::kGCTypeAll) {
                  ^
../node_modules/nan/nan.h:596:20: error: variable or field ‘RemoveGCEpilogueCallback’ declared void
       v8::Isolate::GCEpilogueCallback callback) {
                    ^
../node_modules/nan/nan.h:596:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
       v8::Isolate::GCEpilogueCallback callback) {
       ^
../node_modules/nan/nan.h:601:20: error: variable or field ‘AddGCPrologueCallback’ declared void
       v8::Isolate::GCPrologueCallback callback
                    ^
../node_modules/nan/nan.h:601:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
       v8::Isolate::GCPrologueCallback callback
       ^
../node_modules/nan/nan.h:602:18: error: expected primary-expression before ‘gc_type_filter’
     , v8::GCType gc_type_filter = v8::kGCTypeAll) {
                  ^
../node_modules/nan/nan.h:607:20: error: variable or field ‘RemoveGCPrologueCallback’ declared void
       v8::Isolate::GCPrologueCallback callback) {
                    ^
../node_modules/nan/nan.h:607:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
       v8::Isolate::GCPrologueCallback callback) {
       ^
pty.target.mk:92: recipe for target 'Release/obj.target/pty/src/unix/pty.o' failed
make: *** [Release/obj.target/pty/src/unix/pty.o] Error 1
make: Leaving directory '/home/xxx/usr/share/pty.js/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/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 4.4.8-300.fc23.x86_64
gyp ERR! command "node" "/usr/bin/node-gyp" "configure" "rebuild" "--target=0.37.8" "--target_platform=linux" "--dist-url=https://atom.io/download/atom-shell"
gyp ERR! cwd /home/xxx/usr/share/pty.js
gyp ERR! node -v v0.10.42
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok

I try to update nan to ^2.0.5. Compile pass.

$ git diff
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
   ],
   "dependencies": {
     "extend": "~1.2.1",
-    "nan": "2.0.5"
+    "nan": "^2.0.5"
   },
$ npm install
$ node-gyp configure rebuild --target="0.37.8" --target_platform=linux --dist-url="https://atom.io/download/atom-shell"
  CXX(target) Release/obj.target/pty/src/unix/pty.o
  SOLINK_MODULE(target) Release/obj.target/pty.node
/usr/bin/ld: skipping incompatible /usr/lib/libutil.so when searching for -lutil
/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
  COPY Release/pty.node
gyp info ok

1dot75cm avatar May 01 '16 09:05 1dot75cm

I'm getting a bunch of the same or similar errors on node 6.1.0, Ubuntu MATE 16.04 when I try to compile pty.js:

variable or field ‘AddGCEpilogueCallback’ declared void v8::Isolate::GCEpilogueCallback callback ... variable or field ‘AddGCPrologueCallback’ declared void v8::Isolate::GCPrologueCallback callback ... starting at line 592 of nan.h

I already seem to have nan 2.0.5. FWIW, I added the following lines ahead of line 592 in nan.h:

//kludge: try to fix "variable or field xxxx declared void" errors -DJ
//these don't seem to be defined at this point
//I have no idea if these definitions are correct 
#define GCEpilogueCallback GCCallback
#define GCPrologueCallback GCCallback

and I was able to get pty.js to compile and it seems to be running okay in some quick tests. YMMV

djulien avatar Jun 04 '16 23:06 djulien