首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >节点-gyp重建持续失败

节点-gyp重建持续失败
EN

Stack Overflow用户
提问于 2021-08-23 18:37:46
回答 1查看 2.1K关注 0票数 0

我试着用npm安装玩笑。

代码语言:javascript
运行
复制
npm install jest -g

我想可能会有版本冲突。因此,我尝试配置不同版本的python和MSBuild。但是我仍然不断地得到节点-gyp重建失败的错误。

错误日志如下所示:

代码语言:javascript
运行
复制
C:\WINDOWS\system32>npm i jest -g
npm ERR! code 1
npm ERR! path C:\Users\zhoul\AppData\Roaming\npm\node_modules\jest\node_modules\canvas
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! �ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ������ӡ�-m�����ء�
npm ERR!   Backend.cc
npm ERR! C:\Users\zhoul\AppData\Local\node-gyp\Cache\16.6.1\include\node\node.h(63,10): fatal error C1083: �޷������ļ�: ��v8.h��: No such file or directory [C
:\Users\zhoul\AppData\Roaming\npm\node_modules\jest\node_modules\canvas\build\canvas.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.6.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.6 found at "C:\Program Files\Python39\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.31613.86) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! (node:18044) [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:\Program Files\Python39\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\zhoul\\AppData\\Roaming\\npm\\node_modules\\npm\\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   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\zhoul\\AppData\\Roaming\\npm\\node_modules\\jest\\node_modules\\canvas\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\zhoul\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\zhoul\\AppData\\Local\\\\node-gyp\\\\Cache\\\\16.6.1\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\zhoul\\AppData\\Roaming\\npm\\node_modules\\jest\\node_modules\\canvas',
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   'C:\\Users\\zhoul\\AppData\\Roaming\\npm\\node_modules\\jest\\node_modules\\canvas\\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\Community\MSBuild\Current\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! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\zhoul\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\zhoul\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\zhoul\AppData\Roaming\npm\node_modules\jest\node_modules\canvas
npm ERR! gyp ERR! node -v v16.6.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-08-26 06:55:11

问题解决了。不要手动安装python和c++依赖项,而是使用Windows菜单( node.js文件夹中)中的“安装其他nodejs工具”。和(中国开发商)不使用淘宝npm注册,使用http://registry.npmjs.org

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68897505

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档