I was trying to install web3 package and I am getting this error. Can someone please explain to me the reason behind it? Half of the package gets installed but later half gives error.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\myuser\inbox>npm install --save mocha ganache-cli [email protected]
npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Suppor
t
npm WARN deprecated [email protected]: ?? WARNING ?? tar.gz module has been deprecat
ed and your application is vulnerable. Please use tar module instead: https://np
mjs.com/tar
> [email protected] preinstall C:\Users\myuser\inbox\node_modules\scrypt
> node node-scrypt-preinstall.js
> [email protected] install C:\Users\myuser\inbox\node_modules\scrypt
> node-gyp rebuild
C:\Users\myuser\inbox\node_modules\scrypt>if not defined npm_config_node_gyp (n
ode "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gy
p-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Pr
ogram Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebui
ld )
Traceback (most recent call last):
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_m
ain.py", line 16, in <module>
sys.exit(gyp.script_main())
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 538, in main
return gyp_main(args)
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 514, in gyp_main
options.duplicate_basename_check)
File "C:\Program Files\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\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\generator\msvs.py", line 1916, in CalculateVariables
generator_flags.get('msvs_version', 'auto'))
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\MSVSVersion.py", line 434, in SelectVisualStudioVersion
versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2017'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_module
s\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:198:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\myuser\inbox\node_modules\scrypt
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2018-08-12T16_56_3
4_129Z-debug.log
Do you have Visual Studio Build Tools (with "Visual C++ build tools" workload) or Visual Studio 2017 Community (with the "Desktop development with C++" workload) installed?
I have visual studio code... and I have downloded visual studio build tools externally, since they arent getting installed through npm install --global --production windows-build-tools command
Can you try running npm config set msvs_version 2015 and then retry installing the package?
I have the same issue when trying to install franz.
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
I am running Archlinux (node v8.11.4).
the way it worked for me is I installed the latest version of the visual studio (2017) and set the config in the command line "npm config set msvs_version 2017"
+1
npm install printer --save ~ 1
> [email protected] install C:\Users\lishichao\.babun\cygwin\home\lishichao\node_modules\printer
> node-gyp rebuild
%{)g[blue]%}{ %c } \
%{)g[green]%}if not defined npm_config_node_gyp (node "C:\Users\lishichao\AppData\Roaming\nvm\v10.8.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "node C:\Users\lishichao\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'C:\Users\lishichao\.babun\cygwin\home\lishichao\node_modules\printer\node C:\Users\lishichao\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lishichao\AppData\Roaming\npm-cache\_logs\2018-09-04T12_02_15_485Z-debug.log
when nodejs==10.x.x, I got this error and I downgrade rpm to 5.6 node-gpy rebuild is ok
I believe this is the same issue for me. See bottom for error
Windows 10
Elevated console
Windows build tool didn't work the initially until I ran the vs update update manually.
I have tried setting npm config set msvs_version to 2017, 2015, and 2013 with the same result.
npm bin -g is in my path. I can execute all other commands seen in npm list - g--depth 0 output.
Versions, windows-build-tools, and installing node-gyp (already installed):
PS C:\WINDOWS\system32> npm -v
6.4.1
PS C:\WINDOWS\system32> node -v
v8.12.0
PS C:\WINDOWS\system32> npm bin -g
C:\Users\Zach\AppData\Roaming\npm
PS C:\WINDOWS\system32> npm list -g --depth 0
C:\Users\Zach\AppData\Roaming\npm
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]
PS C:\WINDOWS\system32> npm install --global --production windows-build-tools`
> [email protected] postinstall C:\Users\Zach\AppData\Roaming\npm\node_modules\windows-build-tools
> node ./dist/index.js
Downloading vs_BuildTools.exe
[> ] 0.0% (0 B/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\Zach\.windows-build-tools\vs_BuildTools.exe.
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!
Status from the installers:
---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
------------------- Python --------------------
Python 2.7.15 is already installed, not installing again.
Now configuring the Visual Studio Build Tools..
All done!
+ [email protected]
updated 1 package in 12.504s
PS C:\WINDOWS\system32> npm i -g node-gyp
C:\Users\Zach\AppData\Roaming\npm\node-gyp -> C:\Users\Zach\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js
+ [email protected]
updated 1 package in 4.115s
Error:
PS C:\WINDOWS\system32> node-gyp
C:\WINDOWS\system32>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" ) else (node "" )
module.js:550
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules\node_modules\node-gyp\bin\node-gyp.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
PS C:\WINDOWS\system32>
I was able to fix the error below by modifying node-gyp.cmd file
Error:
`
PS C:\WINDOWS\system32> node-gyp
C:\WINDOWS\system32>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" ) else (node "" )
module.js:550
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules\node_modules\node-gyp\bin\node-gyp.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
PS C:\WINDOWS\system32>
`
I think the problem is being caused because "node-gyp-bin/node-gyp.cmd" gets installed into the "npm-lifecycle" folder, but is actually expecting to be installed in the "node_modules" folder. I fixed it by modifying the path in "node-gyp.cmd" as seen below:
Before:
if not defined npm_config_node_gyp (
node "%~dp0\..\..\node_modules\node-gyp\bin\node-gyp.js" %*
) else (
node "%npm_config_node_gyp%" %*
)
After:
if not defined npm_config_node_gyp (
node "%~dp0\..\..\node-gyp\bin\node-gyp.js" %*
) else (
node "%npm_config_node_gyp%" %*
)
I guess another fix could be to change the environment variable path
Hopefully this helps, this is my first time posting :)
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd E:\GitHub\qzd\qzd-desktop-app\node_modules\ffi
closing due to staleness but two suggestions for people encountering related problems: (1) see https://github.com/nodejs/node-gyp#on-windows for how to get a toolchain properly installed for Windows and (2) try a newer version of node-gyp as there has been more windows work recently that may resolve some of these problems.
Most helpful comment
Do you have Visual Studio Build Tools (with "Visual C++ build tools" workload) or Visual Studio 2017 Community (with the "Desktop development with C++" workload) installed?