I run node 4.1.2 on Windows 10 with VS 2015 Community Edition
I have installed
npm install -g node-gyp
I have set:
npm config set msvs_version 2015
npm config set msvs_version 2015 --global
Runing npm install kerberos yields the following error:
Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\My Project>npm install kerberos
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] bugs['name'] should probably be bugs['url'].
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] querystring is also the name of a node core module.
npm WARN package.json [email protected] string_decoder is also the name of a node core module.
-
> [email protected] install C:\My Project\node_modules\kerberos
> (node-gyp rebuild) || (exit 0)
C:\My Project\node_modules\kerberos>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
Traceback (most recent call last):
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 18, in <module>
sys.exit(gyp.script_main())
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 534, in script_main
return main(sys.argv[1:])
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 527, in main
return gyp_main(args)
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 503, in gyp_main
options.circular_check)
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 98, in Load
generator.CalculateVariables(default_variables, params)
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1867, in CalculateVariables
generator_flags.get('msvs_version', 'auto'))
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 402, in SelectVisualStudioVersion
versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2015'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:343:16)
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 Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\My Project\node_modules\kerberos
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
[email protected] node_modules\kerberos
Note that it uses node-gyp v1.0.3 when npm install -g node-gyp has installed v3.0.3.
This is solved by running:
npm config set node_gyp "node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js"
or
set npm_config_node_gyp=node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js
as demonstrated here below:
Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\My Project>set npm_config_node_gyp=node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js
C:\My Project>npm install kerberos
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] bugs['name'] should probably be bugs['url'].
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] querystring is also the name of a node core module.
npm WARN package.json [email protected] string_decoder is also the name of a node core module.
|
> [email protected] install C:\My Project\node_modules\kerberos
> (node-gyp rebuild) || (exit 0)
C:\My Project\node_modules\kerberos>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node C:\Users\jlche\AppData\R
oaming\npm\node_modules\node-gyp\bin\node-gyp.js rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
kerberos.cc
worker.cc
security_buffer.cc
security_buffer_descriptor.cc
security_context.cc
security_credentials.cc
..\lib\win32\wrappers\security_context.cc(608): warning C4311: 'type cast': pointer truncation from 'unsigned long *' to 'unsigned long' [C:\My Project\node_modules\kerberos\build\kerberos.vcxproj]
..\lib\win32\wrappers\security_context.cc(608): warning C4302: 'type cast': truncation from 'unsigned long *' to 'unsigned long' [C:\My Project\node_modules\kerberos\build\kerberos.vcxproj]
base64.c
kerberos_sspi.c
win_delay_load_hook.c
Creating library C:\My Project\node_modules\kerberos\build\Release\kerberos.lib and object C:\My Project\node_modules\kerberos\build\Release\kerberos.exp
Generating code
Finished generating code
kerberos.vcxproj -> C:\My Project\node_modules\kerberos\build\Release\\kerberos.node
[email protected] node_modules\kerberos
Using the exact same configuration including the fix for installing kerberos, that is set npm_config_node_gyp=node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js
Running npm install -g phonegap now yields the following error:
C:\My Project>npm install -g phonegap
npm WARN engine [email protected]: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.1.2","npm":"2.7.4"})
> [email protected] install C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
bufferutil.cc
C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\nan\nan.h(213): error C2039: 'ThrowException': is not a member of 'v8' [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\me\.node-gyp\4.1.2\include\node\v8.h(66): note: see declaration of 'v8'
C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\nan\nan.h(213): error C2039: 'New': is not a member of 'v8::String' [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\me\.node-gyp\4.1.2\include\node\v8.h(2081): note: see declaration of 'v8::String'
C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\nan\nan.h(213): error C3861: 'New': identifier not found [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\nan\nan.h(213): error C3861: 'ThrowException': identifier not found [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\nan\nan.h(218): error C2039: 'ThrowException': is not a member of 'v8' [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws\build\bufferutil.vcxproj]
[Let's cut some errors here ...]
C:\Users\me\.node-gyp\4.1.2\include\node\v8.h(885): note: see declaration of 'v8::HandleScope::HandleScope'
C:\Users\me\.node-gyp\4.1.2\include\node\v8.h(869): note: see declaration of 'v8::HandleScope'
..\src\validation.cc(109): error C2664: 'v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate *,v8::FunctionCallback,v8::Local<v8::Value>,v8::Local<v8::Signature>,int)': cannot convert argument 1 from 'void (__cdecl *)(const v8::FunctionCallbackInfo<v8::Value> &)' to 'v8::Isolate *' [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\build\validation.vcxproj]
..\src\validation.cc(109): note: There is no context in which this conversion is possible
..\src\validation.cc(112): error C2039: 'NewSymbol': is not a member of 'v8::String' [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\build\validation.vcxproj]
C:\Users\me\.node-gyp\4.1.2\include\node\v8.h(2081): note: see declaration of 'v8::String'
..\src\validation.cc(112): error C3861: 'NewSymbol': identifier not found [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\build\validation.vcxproj]
..\src\validation.cc(134): error C2660: 'v8::True': function does not take 0 arguments [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\build\validation.vcxproj]
..\src\validation.cc(134): error C2660: 'v8::False': function does not take 0 arguments [C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\build\validation.vcxproj]
C:\Users\me\AppData\Roaming\npm\phonegap -> C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js
[email protected] C:\Users\me\AppData\Roaming\npm\node_modules\phonegap
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], archiv
[email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
This is fixed by running the same without setting environment variable npm_config_node_gyp as reproduced below:
Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\My Project>npm install -g phonegap
npm WARN engine [email protected]: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.1.2","npm":"2.7.4"})
> [email protected] install C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
\
C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\nod
e_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
> [email protected] install C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_mo
dules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
C:\Users\me\AppData\Roaming\npm\phonegap -> C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js
[email protected] C:\Users\me\AppData\Roaming\npm\node_modules\phonegap
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], archiv
[email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
Currently npm install kerberos won't work without setting environment variable npm_config_node_gyp after installing npm install -g node-gyp.
But npm install -g phonegap won't work unless environment variable npm_config_node_gyp is not set.
Is there a way to have a configuration that allows both npm install kerberos and npm install -g phonegap to work without setting/unsetting environment variables before running any such commands?
Sorry, I'm going to close this, it's not an issue with node.js core or node-gyp, but with the packages you're trying to install.
On a side note, I'd refrain from installing node-gyp through npm. The version that is shipped with node.js is the one you should use, anything else is asking for trouble.
Please, still can you answer this question, I am facing the same problem and have the same issue, Please respond.
You already have your answer: those packages are broken, they were written for an old version of node.js.
Aside: downvoting but still demanding an answer. Kinda rich, don't you think?
Most helpful comment
You already have your answer: those packages are broken, they were written for an old version of node.js.
Aside: downvoting but still demanding an answer. Kinda rich, don't you think?