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

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

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 44
  • Comments: 251 (41 by maintainers)

Commits related to this issue

Most upvoted comments

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

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

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/

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

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!

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

same problem here with contextify.

Closing, looks like this issue ran its course.

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

apt-get install libkrb5-dev

Also on High Sierra. Initially installed Node via homebrew which installed 10.0.0.

In order to get npm install working I had to:

  • Uninstall node via brew uninstall node
  • Unlink previous node brew unlink node
  • Install older version of node for me it was version 8 brew install node@8
  • Link older version of node with brew link --overwrite --force node@8

How is the issue closed when it’s clearly still a problem?

libtool: unrecognized option `-static’

This is your problem. which libtool should print /usr/bin/libtool. Yours is probably a not-quite-compatible one in, e.g., /usr/local/bin. Try this:

$ env PATH="/usr/bin:$PATH" npm install

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

sudo npm cache clean -f sudo npm install -g n sudo n 8.11.1 try this @mesqueeb

Hey , A little help required here. i am not able to figure out the error while installing realm. Following is the output

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.39
node-pre-gyp info using node@10.0.0 | darwin | x64
node-pre-gyp info check checked for "/Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm/compiled/node-v64_darwin_x64/realm.node" (not found)
node-pre-gyp http GET https://static.realm.io/node-pre-gyp/2.1.1/realm-v2.1.1-node-v64-darwin-x64.tar.gz
node-pre-gyp http 404 https://static.realm.io/node-pre-gyp/2.1.1/realm-v2.1.1-node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://static.realm.io/node-pre-gyp/2.1.1/realm-v2.1.1-node-v64-darwin-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for realm@2.1.1 and node@10.0.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp http 404 status code downloading tarball https://static.realm.io/node-pre-gyp/2.1.1/realm-v2.1.1-node-v64-darwin-x64.tar.gz 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@10.0.0 | darwin | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@10.0.0 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/aayushanand/Documents/mobility/nucleus20/node_modules/node-gyp/gyp/gyp_main.py',
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   '/Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/aayushanand/Documents/mobility/nucleus20/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/aayushanand/.node-gyp/10.0.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/aayushanand/.node-gyp/10.0.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/aayushanand/Documents/mobility/nucleus20/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/aayushanand/.node-gyp/10.0.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@10.0.0 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm/vendor/realm-mac-x64
Resolved requirements: { SYNC_SERVER_FOLDER: 'sync',
  SYNC_ARCHIVE: 'realm-sync-node-cocoa-2.1.10.tar.gz',
  SYNC_ARCHIVE_ROOT: 'realm-sync-node-cocoa-2.1.10' }
Matching lockfile already exists at target - nothing to do (use --force to override)
Success
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  TOUCH Release/obj.target/realm-sync.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/collection_notifications.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/index_set.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/list.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/placeholder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_store.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/results.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/shared_realm.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/thread_safe_reference.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_change_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/object_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/primitive_list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/realm_coordinator.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/results_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/transact_log_handler.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/weak_realm_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/parser/parser.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/parser/query_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/format.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/uuid.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/apple/external_commit_helper.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/apple/keychain_helper.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/sync/impl/apple/network_reachability_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/sync/impl/apple/system_configuration.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/sync/partial_sync.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/sync/sync_config.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/sync/sync_manager.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/sync/sync_user.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/sync/sync_session.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/sync/impl/sync_file.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/sync/impl/sync_metadata.o
  LIBTOOL-STATIC Release/object-store.a
  CXX(target) Release/obj.target/realm/src/js_realm.o
  CXX(target) Release/obj.target/realm/src/node/node_init.o
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:306:25: error: no member named 'Callee' in 'v8::FunctionCallbackInfo<v8::Value>'
        F(isolate, info.Callee(), info.This(), arguments.size(), arguments.data(), return_value);
                   ~~~~ ^
../src/node/node_class.hpp:224:36: error: no viable conversion from 'const typename Types::PropertyGetterCallback' (aka 'void (*const)(Local<v8::String>, const PropertyCallbackInfo<v8::Value> &)') to 'Local<v8::Name>'
    target->SetAccessor(prop_name, property.getter, property.setter ? property.setter : set_readonly_property, v8::Local<v8::Value>(), v8::DEFAULT, attributes);
                                   ^~~~~~~~~~~~~~~
../src/node/node_class.hpp:139:9: note: in instantiation of function template specialization 'realm::node::ObjectWrap<realm::js::RealmClass<realm::node::Types> >::setup_property<v8::Object>' requested here
        setup_property<v8::Object>(constructor, pair.first, pair.second);
        ^
../src/js_realm.hpp:333:68: note: in instantiation of member function 'realm::node::ObjectWrap<realm::js::RealmClass<realm::node::Types> >::create_constructor' requested here
    FunctionType realm_constructor = ObjectWrap<T, RealmClass<T>>::create_constructor(ctx);
                                                                   ^
../src/node/node_init.cpp:27:72: note: in instantiation of member function 'realm::js::RealmClass<realm::node::Types>::create_constructor' requested here
    v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
                                                                       ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const typename Types::PropertyGetterCallback' (aka 'void (*const)(Local<v8::String>, const PropertyCallbackInfo<v8::Value> &)') to 'const v8::Local<v8::Name> &' for 1st argument
class Local {
      ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'const typename Types::PropertyGetterCallback' (aka 'void (*const)(Local<v8::String>, const PropertyCallbackInfo<v8::Value> &)') to 'v8::Local<v8::Name> &&' for 1st argument
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:206:13: note: candidate template ignored: could not match 'Local<type-parameter-0-0>' against 'void (*)(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &)'
  V8_INLINE Local(Local<S> that)
            ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:3215:43: note: passing argument to parameter 'name' here
      Local<Context> context, Local<Name> name,
                                          ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:213:5: error: assigning to 'v8::Context *' from incompatible type 'v8::String *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:167:39: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                      ^~~~~~~~~~~~~~~~~~
../src/node/node_class.hpp:224:25: note: in instantiation of function template specialization 'v8::Local<v8::Context>::Local<v8::String>' requested here
    target->SetAccessor(prop_name, property.getter, property.setter ? property.setter : set_readonly_property, v8::Local<v8::Value>(), v8::DEFAULT, attributes);
                        ^
../src/node/node_class.hpp:139:9: note: in instantiation of function template specialization 'realm::node::ObjectWrap<realm::js::RealmClass<realm::node::Types> >::setup_property<v8::Object>' requested here
        setup_property<v8::Object>(constructor, pair.first, pair.second);
        ^
../src/js_realm.hpp:333:68: note: in instantiation of member function 'realm::node::ObjectWrap<realm::js::RealmClass<realm::node::Types> >::create_constructor' requested here
    FunctionType realm_constructor = ObjectWrap<T, RealmClass<T>>::create_constructor(ctx);
                                                                   ^
../src/node/node_init.cpp:27:72: note: in instantiation of member function 'realm::js::RealmClass<realm::node::Types>::create_constructor' requested here
    v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
                                                                       ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:224:25: error: no viable conversion from 'Local<v8::String>' to 'Local<v8::Context>'
    target->SetAccessor(prop_name, property.getter, property.setter ? property.setter : set_readonly_property, v8::Local<v8::Value>(), v8::DEFAULT, attributes);
                        ^~~~~~~~~
../src/node/node_class.hpp:139:9: note: in instantiation of function template specialization 'realm::node::ObjectWrap<realm::js::CollectionClass<realm::node::Types> >::setup_property<v8::Object>' requested here
        setup_property<v8::Object>(constructor, pair.first, pair.second);
        ^
../src/js_realm.hpp:334:78: note: in instantiation of member function 'realm::node::ObjectWrap<realm::js::CollectionClass<realm::node::Types> >::create_constructor' requested here
    FunctionType collection_constructor = ObjectWrap<T, CollectionClass<T>>::create_constructor(ctx);
                                                                             ^
../src/node/node_init.cpp:27:72: note: in instantiation of member function 'realm::js::RealmClass<realm::node::Types>::create_constructor' requested here
    v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
                                                                       ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'const v8::Local<v8::Context> &' for 1st argument
class Local {
      ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'v8::Local<v8::Context> &&' for 1st argument
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:206:13: note: candidate template ignored: substitution failure [with S = v8::String]
  V8_INLINE Local(Local<S> that)
            ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:3215:22: note: passing argument to parameter 'context' here
      Local<Context> context, Local<Name> name,
                     ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:224:25: error: no viable conversion from 'Local<v8::String>' to 'Local<v8::Context>'
    target->SetAccessor(prop_name, property.getter, property.setter ? property.setter : set_readonly_property, v8::Local<v8::Value>(), v8::DEFAULT, attributes);
                        ^~~~~~~~~
../src/node/node_class.hpp:139:9: note: in instantiation of function template specialization 'realm::node::ObjectWrap<realm::js::ListClass<realm::node::Types> >::setup_property<v8::Object>' requested here
        setup_property<v8::Object>(constructor, pair.first, pair.second);
        ^
../src/js_realm.hpp:335:66: note: in instantiation of member function 'realm::node::ObjectWrap<realm::js::ListClass<realm::node::Types> >::create_constructor' requested here
    FunctionType list_constructor = ObjectWrap<T, ListClass<T>>::create_constructor(ctx);
                                                                 ^
../src/node/node_init.cpp:27:72: note: in instantiation of member function 'realm::js::RealmClass<realm::node::Types>::create_constructor' requested here
    v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
                                                                       ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'const v8::Local<v8::Context> &' for 1st argument
class Local {
      ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'v8::Local<v8::Context> &&' for 1st argument
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:206:13: note: candidate template ignored: substitution failure [with S = v8::String]
  V8_INLINE Local(Local<S> that)
            ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:3215:22: note: passing argument to parameter 'context' here
      Local<Context> context, Local<Name> name,
                     ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:224:25: error: no viable conversion from 'Local<v8::String>' to 'Local<v8::Context>'
    target->SetAccessor(prop_name, property.getter, property.setter ? property.setter : set_readonly_property, v8::Local<v8::Value>(), v8::DEFAULT, attributes);
                        ^~~~~~~~~
../src/node/node_class.hpp:139:9: note: in instantiation of function template specialization 'realm::node::ObjectWrap<realm::js::ResultsClass<realm::node::Types> >::setup_property<v8::Object>' requested here
        setup_property<v8::Object>(constructor, pair.first, pair.second);
        ^
../src/js_realm.hpp:336:72: note: in instantiation of member function 'realm::node::ObjectWrap<realm::js::ResultsClass<realm::node::Types> >::create_constructor' requested here
    FunctionType results_constructor = ObjectWrap<T, ResultsClass<T>>::create_constructor(ctx);
                                                                       ^
../src/node/node_init.cpp:27:72: note: in instantiation of member function 'realm::js::RealmClass<realm::node::Types>::create_constructor' requested here
    v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
                                                                       ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'const v8::Local<v8::Context> &' for 1st argument
class Local {
      ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'v8::Local<v8::Context> &&' for 1st argument
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:206:13: note: candidate template ignored: substitution failure [with S = v8::String]
  V8_INLINE Local(Local<S> that)
            ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:3215:22: note: passing argument to parameter 'context' here
      Local<Context> context, Local<Name> name,
                     ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:224:25: error: no viable conversion from 'Local<v8::String>' to 'Local<v8::Context>'
    target->SetAccessor(prop_name, property.getter, property.setter ? property.setter : set_readonly_property, v8::Local<v8::Value>(), v8::DEFAULT, attributes);
                        ^~~~~~~~~
../src/node/node_class.hpp:139:9: note: in instantiation of function template specialization 'realm::node::ObjectWrap<realm::js::RealmObjectClass<realm::node::Types> >::setup_property<v8::Object>' requested here
        setup_property<v8::Object>(constructor, pair.first, pair.second);
        ^
../src/js_realm.hpp:337:81: note: in instantiation of member function 'realm::node::ObjectWrap<realm::js::RealmObjectClass<realm::node::Types> >::create_constructor' requested here
    FunctionType realm_object_constructor = ObjectWrap<T, RealmObjectClass<T>>::create_constructor(ctx);
                                                                                ^
../src/node/node_init.cpp:27:72: note: in instantiation of member function 'realm::js::RealmClass<realm::node::Types>::create_constructor' requested here
    v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
                                                                       ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'const v8::Local<v8::Context> &' for 1st argument
class Local {
      ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'v8::Local<v8::Context> &&' for 1st argument
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:206:13: note: candidate template ignored: substitution failure [with S = v8::String]
  V8_INLINE Local(Local<S> that)
            ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:3215:22: note: passing argument to parameter 'context' here
      Local<Context> context, Local<Name> name,
                     ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:224:25: error: no viable conversion from 'Local<v8::String>' to 'Local<v8::Context>'
    target->SetAccessor(prop_name, property.getter, property.setter ? property.setter : set_readonly_property, v8::Local<v8::Value>(), v8::DEFAULT, attributes);
                        ^~~~~~~~~
../src/node/node_class.hpp:139:9: note: in instantiation of function template specialization 'realm::node::ObjectWrap<realm::js::SyncClass<realm::node::Types> >::setup_property<v8::Object>' requested here
        setup_property<v8::Object>(constructor, pair.first, pair.second);
        ^
../src/js_sync.hpp:573:66: note: in instantiation of member function 'realm::node::ObjectWrap<realm::js::SyncClass<realm::node::Types> >::create_constructor' requested here
    FunctionType sync_constructor = ObjectWrap<T, SyncClass<T>>::create_constructor(ctx);
                                                                 ^
../src/js_realm.hpp:346:51: note: in instantiation of member function 'realm::js::SyncClass<realm::node::Types>::create_constructor' requested here
    FunctionType sync_constructor = SyncClass<T>::create_constructor(ctx);
                                                  ^
../src/node/node_init.cpp:27:72: note: in instantiation of member function 'realm::js::RealmClass<realm::node::Types>::create_constructor' requested here
    v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
                                                                       ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'const v8::Local<v8::Context> &' for 1st argument
class Local {
      ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'v8::Local<v8::Context> &&' for 1st argument
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:206:13: note: candidate template ignored: substitution failure [with S = v8::String]
  V8_INLINE Local(Local<S> that)
            ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:3215:22: note: passing argument to parameter 'context' here
      Local<Context> context, Local<Name> name,
                     ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:224:25: error: no viable conversion from 'Local<v8::String>' to 'Local<v8::Context>'
    target->SetAccessor(prop_name, property.getter, property.setter ? property.setter : set_readonly_property, v8::Local<v8::Value>(), v8::DEFAULT, attributes);
                        ^~~~~~~~~
../src/node/node_class.hpp:139:9: note: in instantiation of function template specialization 'realm::node::ObjectWrap<realm::js::UserClass<realm::node::Types> >::setup_property<v8::Object>' requested here
        setup_property<v8::Object>(constructor, pair.first, pair.second);
        ^
../src/js_sync.hpp:576:86: note: in instantiation of member function 'realm::node::ObjectWrap<realm::js::UserClass<realm::node::Types> >::create_constructor' requested here
    Object::set_property(ctx, sync_constructor, "User", ObjectWrap<T, UserClass<T>>::create_constructor(ctx), attributes);
                                                                                     ^
../src/js_realm.hpp:346:51: note: in instantiation of member function 'realm::js::SyncClass<realm::node::Types>::create_constructor' requested here
    FunctionType sync_constructor = SyncClass<T>::create_constructor(ctx);
                                                  ^
../src/node/node_init.cpp:27:72: note: in instantiation of member function 'realm::js::RealmClass<realm::node::Types>::create_constructor' requested here
    v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
                                                                       ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'const v8::Local<v8::Context> &' for 1st argument
class Local {
      ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'v8::Local<v8::Context> &&' for 1st argument
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:206:13: note: candidate template ignored: substitution failure [with S = v8::String]
  V8_INLINE Local(Local<S> that)
            ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:3215:22: note: passing argument to parameter 'context' here
      Local<Context> context, Local<Name> name,
                     ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:224:25: error: no viable conversion from 'Local<v8::String>' to 'Local<v8::Context>'
    target->SetAccessor(prop_name, property.getter, property.setter ? property.setter : set_readonly_property, v8::Local<v8::Value>(), v8::DEFAULT, attributes);
                        ^~~~~~~~~
../src/node/node_class.hpp:139:9: note: in instantiation of function template specialization 'realm::node::ObjectWrap<realm::js::SessionClass<realm::node::Types> >::setup_property<v8::Object>' requested here
        setup_property<v8::Object>(constructor, pair.first, pair.second);
        ^
../src/js_sync.hpp:577:92: note: in instantiation of member function 'realm::node::ObjectWrap<realm::js::SessionClass<realm::node::Types> >::create_constructor' requested here
    Object::set_property(ctx, sync_constructor, "Session", ObjectWrap<T, SessionClass<T>>::create_constructor(ctx), attributes);
                                                                                           ^
../src/js_realm.hpp:346:51: note: in instantiation of member function 'realm::js::SyncClass<realm::node::Types>::create_constructor' requested here
    FunctionType sync_constructor = SyncClass<T>::create_constructor(ctx);
                                                  ^
../src/node/node_init.cpp:27:72: note: in instantiation of member function 'realm::js::RealmClass<realm::node::Types>::create_constructor' requested here
    v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
                                                                       ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'const v8::Local<v8::Context> &' for 1st argument
class Local {
      ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::Local<v8::String>' to 'v8::Local<v8::Context> &&' for 1st argument
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:206:13: note: candidate template ignored: substitution failure [with S = v8::String]
  V8_INLINE Local(Local<S> that)
            ^
/Users/aayushanand/.node-gyp/10.0.0/include/node/v8.h:3215:22: note: passing argument to parameter 'context' here
      Local<Context> context, Local<Name> name,
                     ^
10 errors generated.
make: *** [Release/obj.target/realm/src/node/node_init.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/aayushanand/Documents/mobility/nucleus20/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/Cellar/node/8.2.1/bin/node" "/Users/aayushanand/Documents/mobility/nucleus20/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm/compiled/node-v64_darwin_x64/realm.node" "--module_name=realm" "--module_path=/Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm/compiled/node-v64_darwin_x64"
gyp ERR! cwd /Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/8.2.1/bin/node /Users/aayushanand/Documents/mobility/nucleus20/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm/compiled/node-v64_darwin_x64/realm.node --module_name=realm --module_path=/Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm/compiled/node-v64_darwin_x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/aayushanand/Documents/mobility/nucleus20/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:947:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:236:5)
node-pre-gyp ERR! System Darwin 16.7.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/8.2.1/bin/node" "/Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm
node-pre-gyp ERR! node -v v10.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/Cellar/node/8.2.1/bin/node /Users/aayushanand/Documents/mobility/nucleus20/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/aayushanand/Documents/mobility/nucleus20/node_modules/realm/compiled/node-v64_darwin_x64/realm.node --module_name=realm --module_path=/

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.

For me, after I Downgrade the node’s version it works finally.

$ brew install node@8 // install node8

$ brew unlink node // unlink old one

$ brew link node@8 // link node version 8

$ brew link --overwrite --force node@8 // force link version 8

Here are two reference page about Downgrade Node and force link to node 8.

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

Switching from node v12.3.1 to v8.16.0 with nvm solved this for me.

Thanks @belvederef 🎉

Running npm audit fix or npm audit fix --force solved the problem for me

Its been 4 years now, and still this issue remains??

I can confirm, installing node LTS 8.x.x solves all the issues.

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

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

Interesting to note that this issue still persists. After attempting all the possible combinations of solutions (modify ~/.npmrc, remove ~/.node-gyp, clear the npm cache, delete node_modules and even restart the system), what worked with me was downgrading the node.

For me the error mentioned the version numbers like:

gyp ERR! System Darwin 17.7.0
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0

I believe the versions mentioned in the log for node and node-gyp are incompatible. So I reverted to an older node version which worked like a charm.

npm install -g node@11.10.0

There should be a clear documentation describing breaking changes and compatibility issues between the two.

just downgrade node version 8 on mac

I’m on MacOS HighSierra. So I had this issue today, and it was because I was using the Node 10.0, had to downgrade to lts Node 8.11.1 and everything does work.

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

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

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

In my setup, the error was a python one. I has a conda environment activated that used python 3.6, while the code required 2.7

If you don’t want to change your conda setup, this will allow you to go through with the installation: PATH=/usr/bin:$PATH yarn install

Otherwise just run without conda enabled, or switch to a 2.7 environement.

Platform: OSX 10.14.3 node: 11.11.0 yarn: 1.13.0 conda: 4.6.7

Here as well, node v6.2.1

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

Downgrade to a once semi-usable version of NodeJS (v8^) and delete node v10^ artifacts:

rm -rf ~/.node-gyp
rm ~/.npmrc
rm -rf ~/npm
rm -rf node_modules # <- in project folder

sudo apt-get remove nodejs
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
sudo apt-get install -y nodejs

It will work with npm install and yarn install then. I should note that I also installed build-essentials and libkrb5-dev as per comments above, AND have set the python version to 2.7 like so: npm config set python /usr/bin/python2.7, just because I was following along with all the comments and trying everything.

No restart was necessary.

What a sad, sorry state we’ve driven the industry into when it’s more complex to “compile” a bunch of code written in a toy language than it was to parse punch cards in the 1970s or develop a censorship-resistant world computer.

I did yarn instead of npm install…and it worked

Same here, node v6.2.1

@novarac23 I’m getting it with node 6.1.0

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

getting same problem here when trying to install ember-cli

In my case, I removed package-lock.json and node_modules folder. and npm install tada! everything works fine

i had solved this by downgrading the node and npm versions

Before versions:

node - v10.14.2 npm - 6.5.0

i had downgraded to below versions

After versions :

node - v8.11.3 npm - 5.6.0

this issue will be resolved,please try if any one still facing the issue

After switching to a new NodeJS version using n I got this issue as well (I usually do when switching versions…)

This did the trick for me:

npm explore npm -g -- npm install node-gyp@latest

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… 😢

Only @punitnathani’s solution worked for me. Downgrade from node@12.x.x

to

npm install -g node@11.10.0

After trying a gazillion things, only @punitnathani’s solution worked for me.

I am not seeing here any concrete answer for this Problem.

  • downgrading node version help this problem but then node-sass gives problem. Can anyone please write me solution for this problem without downgrading node version? (I have node v12)

sudo npm i

ahahahha god damn, try opening terminal with right click 😄

I was missing g++, this fixed it for me

sudo yum install gcc gcc-c++

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.

@aroc It doesn’t helped for me 😦

@timbergus That is not a node-gyp issue. Whatever module you are compiling needs to be updated to work with Node.js 12.

npm install --global --production windows-build-tools solved my problem

Why this issue is closed an still occur ? I tested on two version, node 8 and 10 and is the same issue. This is unacceptable. After 4 year nobody found a solution for this ? Not even a workaround, nothing work. Shame !!

This problem has to do with the system. It’s going to happen on a 32-bit system. try 64-bit

This worked for me: (Ubuntu)

sudo apt install libavahi-compat-libdnssd-dev

for me helped: apt-get install libkrb5-dev

thanks @samgranger

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!

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…

Nothing of what suggested above worked for me, however, I solved my issue switching to a different node version (e.g. using nvm).

@kukoman: No, upgrade node-sass to the latest version (4.12.0 (atw), see https://www.npmjs.com/package/node-sass).

This has done the job Node 12.1.0, npm 6.9.0 Remove node-gyp Update to node-sass 4.12.0 npm update npm audit fix --force

As for me, I got such error in Gitlab CI pipeline npm install command execution. I suppose it occured because of security vulnerabilities in project dependencies. (Locally everything worked as it should).

Found out about the cause of error after deleting package.lock.json file, commit&push to the origin and succeeded pipeline with npm warning about missing .lock file.

Fixed it by:

  • remove package.lock.json file and node_modules directory;
  • run npm install;
  • if any warnings about vulnerabilities - run npm audit fix;
  • commit new package.lock.json file;

I fix this disabling pyton3 by default in my shell config.

This is what worked for me on Windows:

  1. Download and install Python 2.7.3 (if you have Python 3.x already installed, just leave it, both can coexist)
  2. npm config set python /Python27/python.exe --global
  3. npm rebuild node-sass --force

Just in case anyone else wants to try a different solution, installing g++ with sudo apt-get install g++ solved this issue for me.

Worked for me

npm install node-gyp --python=python2.7 npm install web3 --python=python2.7

Additionally, the S3 bucket of a dependancy was down, so I had to manually install npm install fsevents

@gibfahn Used your solution here (https://github.com/nodejs/node-gyp/issues/809#issuecomment-356900158) and it worked like a charm. Thanks so much!

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

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.

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

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

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

used nvm and downgraded to node v11.10.0, which solved my problem

same here, I had to recreate the whole project

On Fri, 24 May 2019 at 12:18, Francesco Belvedere notifications@github.com wrote:

Nothing of what suggested above worked for me, however, I solved my issue switching to a different node version (using nvm).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nodejs/node-gyp/issues/809?email_source=notifications&email_token=AB65NBJZKWKPOTNB7ZD5CTLPW66GXA5CNFSM4BTZHD42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWE2LKA#issuecomment-495560104, or mute the thread https://github.com/notifications/unsubscribe-auth/AB65NBMWOUG2F55WO7XY62DPW66GXANCNFSM4BTZHD4Q .

This error is still bothering me and I’ve spent way too much time with finding a solution without having to reinstall Windows. If anyone is having trouble installing a specific package and don’t have time to fix this error, I found a work around by just using another package manager; switching to yarn add package-name worked for me. I will eventually reinstall windows to fix this error, which is annoying.

I had to downgrade my node version, I used nvm as suggested by @knoxcard and it worked.

I tried by upgrading or downgrading the version of node , but nothing helped. There was a mismatch between the version which I was installing and the versions mentioned in package.json file.

I tried installing the version specified in package.json file to new path by removing all the exisiting paths. It solved my problem.

I received the following error:

memwatch-next@0.3.0 install: node-gyp rebuild

A few lines below it, I received this error which I failed to read:

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Solution: Installed xcode

yum install gcc-c++

Running this solved the problem for me.

For me, after I Downgrade the node’s version it works finally.

$ brew install node@8 // install node8

$ brew unlink node // unlink old one

$ brew link node@8 // link node version 8

$ brew link --overwrite --force node@8 // force link version 8

Here are two reference page about Downgrade Node and force link to node 8.

I was using node v11 as default from homebrew, and downgrading to node@10 works! thanx

This worked for me: (original comment by @dwieeb)

@smallg You’re getting permission errors for /usr/local/lib/node_modules. This is not an ionic issue, but an issue with your npm setup. See the npm docs: https://docs.npmjs.com/getting-started/fixing-npm-permissions

You can also do the following:

sudo chown -R $(whoami):staff /usr/local/lib/node_modules

This will change the directory owner to be your personal account. Then, never use sudo with npm.

https://github.com/ionic-team/ionic-cli/issues/3127#issuecomment-387791251

It is a list of things I tried.

sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential npm install -g node-gyp sudo npm install -g node-gyp sudo apt-get install gcc-5 These things did not become a means to solve the problem.

I had similar errors popping up while trying to install node-sass. In my case I had to run the command under root privileges:

sudo yarn add --dev node-sass

@shershen08 Have you googled this part of the error make: g++: Command not found ?

You are dancing with python, I wasn’t when I had that error so it might be different

@andrewMuntyan Are you on macOS? I think your error is https://github.com/nodejs/node-gyp/issues/1454 which has been fixed in node-gyp 3.6.3 (via https://github.com/nodejs/node-gyp/pull/1455).

@GheorgheP I very much suspect might be same thing happening to me. I’m on Node 10. Didn’t have issues on the 8 or 6.

But well, I’m not going back an inch though. Will wait till it comes up to speed with Node

I had a problem with node version Wasn’t working on 10.0.1 something like that, nor was it working on 8.1.3 but it worked on 9.11.1

Anyway, check your node version 😄

Ubuntu 16: sudo apt-get install libudev-dev managed to get my npm install running without issue.

@richtera, I ran into this problem too and fixed it by downgrading from npm 5.8.0 to 5.7.0. See here: https://github.com/npm/npm/issues/20163

This thread is huge.

The thread is huge because it’s too general (I npm install’d a module and something went wrong).

@gibfahn I am unable to install sleep by using “sudo npm install sleep”

Nothing to do with node-gyp, that’s an npm issue, and it’s documented here: https://docs.npmjs.com/getting-started/fixing-npm-permissions

the same problem occur with me i solve it with first step 1_ install python 2.7 2_ i added new path to environoment install with python 2.7 location

I set the PYTHON environment variable but I get this error:

[…] gyp ERR! stack Error: Can’t find Python executable “C:Python27python.exe”, you can set the PYTHON env variable. […]

I’m trying to reproduce this locally…

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

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.

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

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

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

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