zzy15596 2022-09-25 21:02 采纳率: 40%
浏览 224
已结题

运行npm install时出现了错误,该怎么解决?

就是我从GitHub上下载了一个node.js写的网站的源码,然后根据一些教程配置环境,但是在npm install出现了错误
错误如下
C:\Users\Administrator\Desktop\loudongw\coding-104>npm install
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated terraformer@1.0.12: terraformer is deprecated and no longer supported. Please use @terraformer/arcgis.
npm WARN deprecated terraformer-wkt-parser@1.2.1: terraformer-wkt-parser is deprecated and no longer supported. Please use @terraformer/wkt.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated sequelize@3.35.1: Please update to v6 or higher! A migration guide can be found here: https://sequelize.org/v6/manual/upgrade-to-v6.html
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated core-js@1.2.7: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path C:\Users\Administrator\Desktop\loudongw\coding-104\node_modules\ccap
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@9.1.0
npm ERR! gyp info using node@18.9.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.7 found at "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:364:14)
npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:385:16
npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:420:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! System Windows_NT 10.0.17763
npm ERR! 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"
npm ERR! gyp ERR! cwd C:\Users\Administrator\Desktop\loudongw\coding-104\node_modules\ccap
npm ERR! gyp ERR! node -v v18.9.1
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Local\npm-cache_logs\2022-09-25T09_25_20_998Z-debug-0.log

  • 写回答

8条回答 默认 最新

  • 优质网络系统领域创作者 网络领域新星创作者 2022-09-26 07:41
    关注

    npm i --legacy-peer-deps
    然后执行npm install 问题解决

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • 不太能吃 2022-09-25 21:56
    关注

    看报错应该是npm和node版本问题,可以尝试一下解决方案:

    1. 升级npm版本:npm install -g npm -- 默认升级为最新版本
    2. 安装node 12.16.0版本:nvm install v12.16.0; nvm use v12.16.0
    评论
  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-25 22:11
    关注
    评论
  • iloveozz 2022-09-25 23:15
    关注

    基本上都是gyp变异出错,gyp是真的烦,编译需要python又需要visual studio,通常用到gyp好像是用到了node sass所以你可以这么干
    按照提示的错误安装和配置好python和visual studio环境,麻烦

    或者你知yarn install试一下,简单,需要先装yarn,不一定有用

    或者,node换用淘宝源,应该可以吧

    评论
  • Climbing-pit 2022-09-25 23:37
    关注

    版本问题!建议npm install --force看看

    评论
  • 孙叫兽 前端领域优质创作者 2022-09-26 07:55
    关注

    卸载重新装,如果是win7 电脑,把node 版本装到12以下

    评论
  • 崽崽的谷雨 2022-09-26 09:09
    关注

    用管理员 身份 运行 npm install --global --production windows-build-tools

    评论
  • 关注

    安装node时指定下版本

    评论
查看更多回答(7条)

报告相同问题?

问题事件

  • 系统已结题 10月4日
  • 已采纳回答 9月26日
  • 创建了问题 9月25日

悬赏问题

  • ¥15 欧姆龙PLC 电机控制 限位
  • ¥30 如何处理shell命令接收到的视频流并实时播放出来
  • ¥15 虚心请教C#的代码优化问题
  • ¥15 有偿求做台风过境全过程模拟仿真
  • ¥50 求!AutomationDesk 如何自动导入Variant数据
  • ¥20 Next.JS 静态导出路由
  • ¥15 我做一个对中文文本情感分析的项目 我用了CNN,和keras框架 报的错误我一直处理不好
  • ¥15 unity使用bakery打光烘焙所遇到的问题。
  • ¥99 二维有限元方法求解,泊松方程
  • ¥35 我需要在PC端 开两个抖店工作台客户端.(语言-java)