无法使用NPM在本地获取颁发者证书

无法使用NPM在本地获取颁发者证书,npm,certificate,npm-install,Npm,Certificate,Npm Install,我知道这个问题似乎被问了很多,但我认为我的问题有点不同。运行命令sudo npm install-g@vue/cli时,我收到错误消息: npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY npm ERR! request to https://registry.npmjs.org/@vue%2fcli failed, reason: unable to

我知道这个问题似乎被问了很多,但我认为我的问题有点不同。运行命令sudo npm install-g@vue/cli时,我收到错误消息:

npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/@vue%2fcli failed, reason: unable to get local issuer certificate
通常的解决方案似乎是运行
npm配置集注册表http://registry.npmjs.org/
npm set strict ssl false
并创建证书文件并运行
export NODE\u EXTRA\u CA\u CERTS=/etc/ssl/CERTS/CA certificates.crt
npm config set cafile”“
。这两种方法都不管用。我还试着复制我的同事的crt文件(它在他的电脑上工作),但仍然不起作用。当我添加
--注册表时http://registry.npmjs.org/
到我的npm安装请求或运行
warn global add@vue/cli
它也可以工作。奇怪地;当我在npm安装请求中不使用sudo时,它不会抱怨证书,而是会在一段时间后停止,因为它无法访问某些文件和目录。使用
sudo
时,会立即显示错误

我的.npmrc文件如下所示:

registry=http://registry.npmjs.org/
strict-ssl=true
proxy=http://tcsproxy.xxxxx.net:8080/
http-proxy=http://tcsproxy.xxxxx.net:8080
https-proxy=http://tcsproxy.xxxxx.net:8080/
cafile=/etc/ssl/certs/ca-certificates.crt
metrics-registry=http://registry.npmjs.org/
我在Windows10中的Ubuntu虚拟机上工作,我不完全确定我的公司防火墙/网络配置是如何工作的,但我认为现在不重要了。我也许可以在以后的案例中继续使用
--registry
参数,但我担心它会在其他地方引起问题,因此如果有人能看到我做错了什么,我将不胜感激