刚才处理了一个npm的问题,真的是太难了,这个npm的问题太深奥了。
idea打开了一个新的项目,
问题一
cmd可以识别node和npm;IDEA无法识别;
解决方法
着说明环境变量的配置是正确的,我们需要配置IDEA的Terminal
File—Settings—Tools—Terminal
找到ShellPath配置的地址非本地地址,选中里面有本地地址的候选,选中保存,重启IDEA即可。
问题二
npm报错
原因是:电脑缺少cmd运行程序的环境变量
spawn xxx ENOENT 就是缺少对应的运行程序的环境变量
解决方法
打开环境变量—打开系统变量—找到Path—点击编辑—点击新建—增加【C:\windows\system32】然后重启即可。
问题三
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT 151.101.196.162:443
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! Please include the following file with any support request:
这个问题真的搞人心态
试了好久
看翻译应该是代理的问题
解决方法
npm config set proxy false
npm cache clean
npm cache clear --force && npm install --no-shrinkwrap --update-binary
然后第一步 把代理设置为空
第二步 清理缓存 (如果第二部不可行,直接第三步)
第三步 强制清理缓存 (非常好用,其他有问题也可解决)
然后就可以继续然后了