侧边栏壁纸
  • 累计撰写 416 篇文章
  • 累计创建 65 个标签
  • 累计收到 150 条评论

目 录CONTENT

文章目录

npm 安装过程中各种ERR问题处理

Z同学
2022-03-29 / 0 评论 / 6 点赞 / 7,882 阅读 / 1,507 字
温馨提示:
本文最后更新于 2022-03-29,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

介绍

在使用npm过程中出现的问题记录,并附上相关的解决方法。

希望能够给小伙伴一些参考

1. npm ERR ! gyp ERR ! find Python

没有找到Python。npm依赖到了Python。我们需要主动在电脑中配置安装Python

image-20220329155629831

可以直接使用Microsoft Store 搜索 Python3 进行下载安装即可

image-20220329155756307

安装完毕后,在cmd中输入 python --version 就能看到相关版本了。
image-20220329155837624

2. npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use

执行npm操作的时候出现错误:

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 checking VS2019 (16.11.32228.343) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
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

image-20220329162057549

我们本地没有visual Studio C++ core features。也就是说没有安装Visual Studio

需要主动安装:

image-20220329162254794

3.npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1

如果运行后出现了gyp错误,那么就代表我们的npm环境中gyp配置有问题。

image-20220329175401499

解决,我们需要安装gyp

1.安装 npm install -g node-gyp
2.安装 npm install --global --production windows-build-tools

6

评论区