介绍
在使用npm过程中出现的问题记录,并附上相关的解决方法。
希望能够给小伙伴一些参考
1. npm ERR ! gyp ERR ! find Python
没有找到Python。npm依赖到了Python。我们需要主动在电脑中配置安装Python
可以直接使用Microsoft Store 搜索 Python3 进行下载安装即可
安装完毕后,在cmd中输入 python --version 就能看到相关版本了。
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
我们本地没有visual Studio C++ core features。也就是说没有安装Visual Studio
需要主动安装:
3.npm ERR! gyp ERR! stack Error: gyp
failed with exit code: 1
如果运行后出现了gyp错误,那么就代表我们的npm环境中gyp配置有问题。
解决,我们需要安装gyp
1.安装 npm install -g node-gyp
2.安装 npm install --global --production windows-build-tools
评论区