eslint / eslint

Find and fix problems in your JavaScript code.
https://eslint.org
MIT License
24.87k stars 4.5k forks source link

Error: Installation error when running npm install #4760

Closed kaicataldo closed 8 years ago

kaicataldo commented 8 years ago

I'm getting an installation error (logs below) when running npm i in my clean master repo of my local development fork as of commit 3b9fe1f6aeb95a8b70535de4b9c143869fe53ce1.

Did some detective work and the error appears to be thrown by an older version of chokidar, which is a dependency of an older version of beefy. Please see logs below.

> chokidar@0.8.1 postinstall /Users/kaicataldo/Projects/eslint/node_modules/chokidar
> node setup-deps.js

Executing npm install fsevents@0.1.6 recursive-readdir@0.0.2
../nodefsevents.cc:31:30: error: expected class name
  class NodeFSEvents : node::ObjectWrap {
                             ^
../nodefsevents.cc:66:51: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
      static v8::Handle<v8::Value> Shutdown(const v8::Arguments& args) {
                                                  ^~~~~~~~~~~~~
                                                  v8::internal::Arguments
/Users/kaicataldo/.node-gyp/5.3.0/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../nodefsevents.cc:72:46: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
      static v8::Handle<v8::Value> New(const v8::Arguments& args) {
                                             ^~~~~~~~~~~~~
                                             v8::internal::Arguments
/Users/kaicataldo/.node-gyp/5.3.0/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../nodefsevents.cc:34:21: error: calling a protected constructor of class 'v8::HandleScope'
        HandleScope scope;
                    ^
/Users/kaicataldo/.node-gyp/5.3.0/include/node/v8.h:889:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../nodefsevents.cc:35:20: error: use of undeclared identifier 'NODE_PSYMBOL'
        emit_sym = NODE_PSYMBOL("emit");
                   ^
../nodefsevents.cc:36:22: error: use of undeclared identifier 'NODE_PSYMBOL'
        change_sym = NODE_PSYMBOL("fsevent");
                     ^
../nodefsevents.cc:37:59: error: cannot initialize a parameter of type 'v8::Isolate *' with an lvalue of type 'v8::Handle<v8::Value> (const v8::internal::Arguments &)'
        Local<FunctionTemplate> t = FunctionTemplate::New(NodeFSEvents::New);
                                                          ^~~~~~~~~~~~~~~~~
/Users/kaicataldo/.node-gyp/5.3.0/include/node/v8.h:4349:16: note: passing argument to parameter 'isolate' here
      Isolate* isolate, FunctionCallback callback = 0,
               ^
../nodefsevents.cc:38:62: error: 'New' is a private member of 'v8::PersistentBase<v8::FunctionTemplate>'
        constructor_template = Persistent<FunctionTemplate>::New(t);
                                                             ^
/Users/kaicataldo/.node-gyp/5.3.0/include/node/v8.h:643:23: note: declared private here
  V8_INLINE static T* New(Isolate* isolate, T* that);
                      ^
../nodefsevents.cc:38:67: error: too few arguments to function call, expected 2, have 1
        constructor_template = Persistent<FunctionTemplate>::New(t);
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
/Users/kaicataldo/.node-gyp/5.3.0/include/node/v8.h:643:3: note: 'New' declared here
  V8_INLINE static T* New(Isolate* isolate, T* that);
  ^
/Users/kaicataldo/.node-gyp/5.3.0/include/node/v8config.h:301:20: note: expanded from macro 'V8_INLINE'
# define V8_INLINE inline __attribute__((always_inline))
                   ^
../nodefsevents.cc:39:29: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
        constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
        ~~~~~~~~~~~~~~~~~~~~^~
                            .
../nodefsevents.cc:39:31: error: no member named 'InstanceTemplate' in 'v8::Persistent<v8::FunctionTemplate, v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
        constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
        ~~~~~~~~~~~~~~~~~~~~  ^
../nodefsevents.cc:40:29: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
        constructor_template->SetClassName(String::NewSymbol("FSEvents"));
        ~~~~~~~~~~~~~~~~~~~~^~
                            .
../nodefsevents.cc:40:31: error: no member named 'SetClassName' in 'v8::Persistent<v8::FunctionTemplate, v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
        constructor_template->SetClassName(String::NewSymbol("FSEvents"));
        ~~~~~~~~~~~~~~~~~~~~  ^
../nodefsevents.cc:40:52: error: no member named 'NewSymbol' in 'v8::String'
        constructor_template->SetClassName(String::NewSymbol("FSEvents"));
                                           ~~~~~~~~^
../nodefsevents.cc:41:59: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
        Local<Function> constructor = constructor_template->GetFunction();
                                      ~~~~~~~~~~~~~~~~~~~~^~
                                                          .
../nodefsevents.cc:41:61: error: no member named 'GetFunction' in 'v8::Persistent<v8::FunctionTemplate, v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
        Local<Function> constructor = constructor_template->GetFunction();
                                      ~~~~~~~~~~~~~~~~~~~~  ^
../nodefsevents.cc:43:93: error: too few arguments to function call, expected 2, have 1
        constructor->Set(String::New("kFSEventStreamEventFlagNone"), Integer::New(0x00000000));
                                                                     ~~~~~~~~~~~~           ^
/Users/kaicataldo/.node-gyp/5.3.0/include/node/v8.h:2496:3: note: 'New' declared here
  static Local<Integer> New(Isolate* isolate, int32_t value);
  ^
../nodefsevents.cc:43:34: error: no member named 'New' in 'v8::String'
        constructor->Set(String::New("kFSEventStreamEventFlagNone"), Integer::New(0x00000000));
                         ~~~~~~~~^
../nodefsevents.cc:44:104: error: too few arguments to function call, expected 2, have 1
        constructor->Set(String::New("kFSEventStreamEventFlagMustScanSubDirs"), Integer::New(0x00000001));
                                                                                ~~~~~~~~~~~~           ^
/Users/kaicataldo/.node-gyp/5.3.0/include/node/v8.h:2496:3: note: 'New' declared here
  static Local<Integer> New(Isolate* isolate, int32_t value);
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/fswatch/nodefsevents.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/kaicataldo/.nvm/versions/node/v5.3.0/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 Darwin 15.2.0
gyp ERR! command "/Users/kaicataldo/.nvm/versions/node/v5.3.0/bin/node" "/Users/kaicataldo/.nvm/versions/node/v5.3.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/kaicataldo/Projects/eslint/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v5.3.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN chokidar@0.8.1 No license field.
npm ERR! Darwin 15.2.0
npm ERR! argv "/Users/kaicataldo/.nvm/versions/node/v5.3.0/bin/node" "/Users/kaicataldo/.nvm/versions/node/v5.3.0/bin/npm" "install" "fsevents@0.1.6" "recursive-readdir@0.0.2"
npm ERR! node v5.3.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

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

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/kaicataldo/Projects/eslint/node_modules/chokidar/npm-debug.log
eslintbot commented 8 years ago

@kaicataldo Thanks for the issue! If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

nzakas commented 8 years ago

What version of Node are you using? (I'm concerned this might be version specific)

alberto commented 8 years ago

From the log: npm ERR! node v5.3.0 npm ERR! npm v3.5.2

gyandeeps commented 8 years ago

Node 5.3.x by default ships with npm 3.3.12. I dont know if that makes a difference as all of our travis builds are passing. Something I have seen before is that if you have visual studio installed on your machine and if it doesnt go with the optional dependencies of various modules then it makes your build fail also(because of optional dependency failures).

Do you have visual studio on your machine?

kaicataldo commented 8 years ago

@gyandeeps I do have Visual Studio Code installed on my machine. I'm trying to understand why that might cause this.

@nzakas I'm using Node v5.3.0 and npm v3.5.2, but I also tried installing with Node v4.2.3 and npm v2.14.7 and got the same error (logs below):

> chokidar@0.8.1 postinstall /Users/kaicataldo/Projects/eslint/node_modules/beefy/node_modules/chokidar
> node setup-deps.js

Executing npm install fsevents@0.1.6 recursive-readdir@0.0.2
npm WARN package.json chokidar@0.8.1 No license field.
../nodefsevents.cc:31:30: error: expected class name
  class NodeFSEvents : node::ObjectWrap {
                             ^
../nodefsevents.cc:66:51: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
      static v8::Handle<v8::Value> Shutdown(const v8::Arguments& args) {
                                                  ^~~~~~~~~~~~~
                                                  v8::internal::Arguments
/Users/kaicataldo/.node-gyp/4.2.3/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../nodefsevents.cc:72:46: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
      static v8::Handle<v8::Value> New(const v8::Arguments& args) {
                                             ^~~~~~~~~~~~~
                                             v8::internal::Arguments
/Users/kaicataldo/.node-gyp/4.2.3/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../nodefsevents.cc:34:21: error: calling a protected constructor of class 'v8::HandleScope'
        HandleScope scope;
                    ^
/Users/kaicataldo/.node-gyp/4.2.3/include/node/v8.h:885:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../nodefsevents.cc:35:20: error: use of undeclared identifier 'NODE_PSYMBOL'
        emit_sym = NODE_PSYMBOL("emit");
                   ^
../nodefsevents.cc:36:22: error: use of undeclared identifier 'NODE_PSYMBOL'
        change_sym = NODE_PSYMBOL("fsevent");
                     ^
../nodefsevents.cc:37:59: error: cannot initialize a parameter of type 'v8::Isolate *' with an lvalue of type 'v8::Handle<v8::Value> (const v8::internal::Arguments &)'
        Local<FunctionTemplate> t = FunctionTemplate::New(NodeFSEvents::New);
                                                          ^~~~~~~~~~~~~~~~~
/Users/kaicataldo/.node-gyp/4.2.3/include/node/v8.h:4350:16: note: passing argument to parameter 'isolate' here
      Isolate* isolate, FunctionCallback callback = 0,
               ^
../nodefsevents.cc:38:62: error: 'New' is a private member of 'v8::PersistentBase<v8::FunctionTemplate>'
        constructor_template = Persistent<FunctionTemplate>::New(t);
                                                             ^
/Users/kaicataldo/.node-gyp/4.2.3/include/node/v8.h:639:23: note: declared private here
  V8_INLINE static T* New(Isolate* isolate, T* that);
                      ^
../nodefsevents.cc:38:67: error: too few arguments to function call, expected 2, have 1
        constructor_template = Persistent<FunctionTemplate>::New(t);
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
/Users/kaicataldo/.node-gyp/4.2.3/include/node/v8.h:639:3: note: 'New' declared here
  V8_INLINE static T* New(Isolate* isolate, T* that);
  ^
/Users/kaicataldo/.node-gyp/4.2.3/include/node/v8config.h:301:20: note: expanded from macro 'V8_INLINE'
# define V8_INLINE inline __attribute__((always_inline))
                   ^
../nodefsevents.cc:39:29: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
        constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
        ~~~~~~~~~~~~~~~~~~~~^~
                            .
../nodefsevents.cc:39:31: error: no member named 'InstanceTemplate' in 'v8::Persistent<v8::FunctionTemplate, v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
        constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
        ~~~~~~~~~~~~~~~~~~~~  ^
../nodefsevents.cc:40:29: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
        constructor_template->SetClassName(String::NewSymbol("FSEvents"));
        ~~~~~~~~~~~~~~~~~~~~^~
                            .
../nodefsevents.cc:40:31: error: no member named 'SetClassName' in 'v8::Persistent<v8::FunctionTemplate, v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
        constructor_template->SetClassName(String::NewSymbol("FSEvents"));
        ~~~~~~~~~~~~~~~~~~~~  ^
../nodefsevents.cc:40:52: error: no member named 'NewSymbol' in 'v8::String'
        constructor_template->SetClassName(String::NewSymbol("FSEvents"));
                                           ~~~~~~~~^
../nodefsevents.cc:41:59: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
        Local<Function> constructor = constructor_template->GetFunction();
                                      ~~~~~~~~~~~~~~~~~~~~^~
                                                          .
../nodefsevents.cc:41:61: error: no member named 'GetFunction' in 'v8::Persistent<v8::FunctionTemplate, v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
        Local<Function> constructor = constructor_template->GetFunction();
                                      ~~~~~~~~~~~~~~~~~~~~  ^
../nodefsevents.cc:43:93: error: too few arguments to function call, expected 2, have 1
        constructor->Set(String::New("kFSEventStreamEventFlagNone"), Integer::New(0x00000000));
                                                                     ~~~~~~~~~~~~           ^
/Users/kaicataldo/.node-gyp/4.2.3/include/node/v8.h:2499:3: note: 'New' declared here
  static Local<Integer> New(Isolate* isolate, int32_t value);
  ^
../nodefsevents.cc:43:34: error: no member named 'New' in 'v8::String'
        constructor->Set(String::New("kFSEventStreamEventFlagNone"), Integer::New(0x00000000));
                         ~~~~~~~~^
../nodefsevents.cc:44:104: error: too few arguments to function call, expected 2, have 1
        constructor->Set(String::New("kFSEventStreamEventFlagMustScanSubDirs"), Integer::New(0x00000001));
                                                                                ~~~~~~~~~~~~           ^
/Users/kaicataldo/.node-gyp/4.2.3/include/node/v8.h:2499:3: note: 'New' declared here
  static Local<Integer> New(Isolate* isolate, int32_t value);
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/fswatch/nodefsevents.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/kaicataldo/.nvm/versions/node/v4.2.3/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 15.2.0
gyp ERR! command "/Users/kaicataldo/.nvm/versions/node/v4.2.3/bin/node" "/Users/kaicataldo/.nvm/versions/node/v4.2.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/kaicataldo/Projects/eslint/node_modules/beefy/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v4.2.3
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Darwin 15.2.0
npm ERR! argv "/Users/kaicataldo/.nvm/versions/node/v4.2.3/bin/node" "/Users/kaicataldo/.nvm/versions/node/v4.2.3/bin/npm" "install" "fsevents@0.1.6" "recursive-readdir@0.0.2"
npm ERR! node v4.2.3
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! fsevents@0.1.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fsevents@0.1.6 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the fsevents 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 fsevents
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/kaicataldo/Projects/eslint/node_modules/beefy/node_modules/chokidar/npm-debug.log
kaicataldo commented 8 years ago

@gyandeeps I just removed Visual Studio Code from my machine and am still getting the error on installation. Also tried installing with Node v5.3.0 and npm v3.3.12 (after removing Visual Studio Code) and got the same error, so doesn't seem like it's related in this specific instance.

@nzakas What versions of Node is ESLint currently supporting? >=4.x? I haven't tried the installation on 0.12 or lower, but am consistently getting the error with 4.x and 5.x.

Out of curiosity, have there been any other reports of this issue? Thanks all for helping solve this.

kaicataldo commented 8 years ago

Whoops, did not mean to close. Sorry!

gyandeeps commented 8 years ago

Not an expert in the field of how C++ bindings get compiled with nodejs. Mostly it depends on what version of C++ compiler you have on your machine. Now even if you remove Visual studio it doesnt remove the C++ distribution binaries. But those binaries do get updated when you install visual studio. Now maybe whats happening in your case is that that c++ binary got updated wen you installed the visual studio, so now when you fsevents modules tries to compile its C++ binding then it fails. Maybe the reason is because its not compatible with latest C++ compiler/binaries. Even 64 bit vs 32 bit plays some rle here.

This is what I think is happening but dont take my word for it. As I saw this happening on my colleagues machine long time back.

I think there is a work around for this where you can do npm install using powershell and pass in some flags. I will look if I can find this. This is the reason I never installed Visual Studio on my machine (hahahaha) :smile:

kaicataldo commented 8 years ago

Thanks for the explanation, @gyandeeps. That would explain why it's not failing in the Travis builds. Might also only affect OSX, given that the package that's emitting the error (fsevents) is an OSX-specific package.

@nzakas If this is indeed the case, what is the best way forward? Updating the beefy package seems to be an easy fix, though I don't know how I'd test for backwards compatibility, since we're out of the realm of Node. Thanks again.

kaicataldo commented 8 years ago

Just to be clear though, I installed Visual Studio Code, the Electron-based text editor, on my Mac. Not Visual Studio.

Perhaps it has something to do with my OS? I've been trying to think of what relevant things have changed that might have caused this. Other than updating my Node and npm and trying out Visual Studio Code, I'm using the latest version of OSX (El Capitan) and there was a software update a few days ago. I'm wondering if the update was not backwards-compatible with the version of fsevents packaged with the older version of beefy.

Apologies for the multiple responses to dig through!

nzakas commented 8 years ago

My main concern is that upgrading doesn't break all Node < 4 installations, so we just need to verify that the update still works with Node 0.10 and 0.12.

kaicataldo commented 8 years ago

Got it. Tested locally (successful installation & was able to successfully run npm run profile) with:

and all the Travis CI tests are passing on my PR. Anything else I can check?

nzakas commented 8 years ago

Nope, that's all we need!