无法 "npm install" 项目
Unable to "npm install" on project
我正在尝试使用新计算机在现有项目上安装 npm,但出现错误“gyp ERR!”。
我尝试重新安装 NPM,重新安装 python 旧版本,安装不同版本的 NPM,但它不起作用,错误是一样的。我以前从未遇到过这个错误。
我尝试删除节点模块并下载 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 Studio19\BuildTools\MSBuild.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 Studio19\BuildTools\MSBuild.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\_logs21-10-27T11_10_12_874Z-debug.log[1]
[1]: https://i.stack.imgur.com/fXDoa.png
编辑:
已尝试在受影响的计算机上重置 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\_logs21-10-27T13_17_56_362Z-debug.log
第 1 步 - 检查您是否有虚拟环境,如果没有(python -m venv “项目位置”)
第 2 步 - Select 解释器,因为虚拟环境已创建(在 Visual Studio 中对其进行编码 ctrl+shift+p )然后单击“select 解释器”,然后 select“输入解释器路径”,然后 select“浏览您的文件系统以找到 python 解释器”,然后转到安装的虚拟环境 select python.exe 文件
第 3 步 - 在 VS 代码中打开终端,然后在文件路径中转到脚本文件夹(cd 脚本),然后输入“.\activate”
第 4 步 - pip install npm
希望这对你有用
我已经解决了我的问题。这不是因为我的 node.js 配置也不是 python 问题。问题出在我的项目中。
我对最新的提交做了一个 npm 运行 观察,这个被窃听了。
我刚刚使用 npm 运行 prod 进行了先例提交,一切正常。
我正在尝试使用新计算机在现有项目上安装 npm,但出现错误“gyp ERR!”。
我尝试重新安装 NPM,重新安装 python 旧版本,安装不同版本的 NPM,但它不起作用,错误是一样的。我以前从未遇到过这个错误。
我尝试删除节点模块并下载 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 Studio19\BuildTools\MSBuild.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 Studio19\BuildTools\MSBuild.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\_logs21-10-27T11_10_12_874Z-debug.log[1]
[1]: https://i.stack.imgur.com/fXDoa.png
编辑: 已尝试在受影响的计算机上重置 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\_logs21-10-27T13_17_56_362Z-debug.log
第 1 步 - 检查您是否有虚拟环境,如果没有(python -m venv “项目位置”) 第 2 步 - Select 解释器,因为虚拟环境已创建(在 Visual Studio 中对其进行编码 ctrl+shift+p )然后单击“select 解释器”,然后 select“输入解释器路径”,然后 select“浏览您的文件系统以找到 python 解释器”,然后转到安装的虚拟环境 select python.exe 文件 第 3 步 - 在 VS 代码中打开终端,然后在文件路径中转到脚本文件夹(cd 脚本),然后输入“.\activate” 第 4 步 - pip install npm
希望这对你有用
我已经解决了我的问题。这不是因为我的 node.js 配置也不是 python 问题。问题出在我的项目中。
我对最新的提交做了一个 npm 运行 观察,这个被窃听了。
我刚刚使用 npm 运行 prod 进行了先例提交,一切正常。