我试图在一个已有的项目中,在一台新的电脑上使用npm install,但是出现了“gyp ERR!” 的错误。
我尝试重新安装NPM、安装较旧版本的python、安装不同版本的NPM,但都没有成功,错误仍然存在。我以前从未遇到过这个错误。
我尝试删除node_modules并下载Visual Build Tools,但结果相同。
以下为错误日志:
npm ERR! code 7
npm ERR! path D:\APCOM\wamp64\www\dev\newPlanSub\node_modules\fibers
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.13.0 | win32 | x64
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.0/node-v16.13.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.0/node-v16.13.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.0/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.0/win-x86/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.0/win-x64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.0/win-x86/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.0/win-x64/node.lib
npm ERR! (node:12632) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn C:\Users\Apcom\.windows-build-tools\python27\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'D:\\APCOM\\wamp64\\www\\dev\\newPlanSub\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-G',
npm ERR! gyp info spawn args 'msvs_version=2015',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\\APCOM\\wamp64\\www\\dev\\newPlanSub\\node_modules\\fibers\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\\APCOM\\wamp64\\www\\dev\\newPlanSub\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\Apcom\\.node-gyp\\16.13.0\\include\\node\\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\\Users\\Apcom\\.node-gyp\\16.13.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=D:\\APCOM\\wamp64\\www\\dev\\newPlanSub\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\Apcom\\.node-gyp\\16.13.0\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=D:\\APCOM\\wamp64\\www\\dev\\newPlanSub\\node_modules\\fibers',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'D:\\APCOM\\wamp64\\www\\dev\\newPlanSub\\node_modules\\fibers\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe ENOENT
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:477:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\APCOM\\wamp64\\www\\dev\\newPlanSub\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\APCOM\wamp64\www\dev\newPlanSub\node_modules\fibers
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! This is a bug in `node-gyp`.
npm ERR! gyp ERR! Try to update node-gyp and file an Issue if it does not help:
npm ERR! gyp ERR! <https://github.com/nodejs/node-gyp/issues>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Apcom\AppData\Local\npm-cache\_logs\2021-10-27T11_10_12_874Z-debug.log[1]
[1]: https://istack.dev59.com/fXDoa.webp
编辑: 尝试在受影响的计算机上重置Windows,但Gyp错误信息仍然出现。
npm ERR! code 1
npm ERR! path C:\wamp64\www\plansubs\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.13.0 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python310\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:397:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1064:16)
npm ERR! gyp ERR! stack at Socket.<anonymous> (node:internal/child_process:450:11)
npm ERR! gyp ERR! stack at Socket.emit (node:events:390:28)
npm ERR! gyp ERR! stack at Pipe.<anonymous> (node:net:687:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\wamp64\\www\\plansubs\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\wamp64\www\plansubs\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\capit\AppData\Local\npm-cache\_logs\2021-10-27T13_17_56_362Z-debug.log
node-gyp
需要在您的计算机上安装一些东西才能运行。请遵循它们的指南,这通常可以解决问题:https://github.com/nodejs/node-gyp#installation - ssc-hrep3