npm ERR! code ENOTFOUND,network In most cases you are behind a proxy or have bad network settings.

问题如下:

npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.cnpmjs.org/html2canvas failed, reason: getaddrinfo ENOTFOUND registry.cnpmjs.org
npm ERR! network This is a problem 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! A complete log of this run can be found in:
npm ERR!     C:\Users\Dell\AppData\Local\npm-cache\_logs\2024-08-28T08_37_33_765Z-debug-0.log

解决方法:

npm config get proxy
npm config get https-proxy
如果返回值不为null,继续执行(谁不为空设置谁为空):
npm config set proxy null
npm config set https-proxy null
如果两个值返回都为null执行:
npm config set registry https://registry.cnpmjs.org/

如图:
在这里插入图片描述
如果执行完后还是报错则:
搜索该文件:
在这里插入图片描述

把文件内容覆盖为:

http-proxy=http://proxyhost/:proxyport
strict-ssl=false
registry=https://registry.npmjs.org/

在这里插入图片描述

npm ERR! code ENOTFOUND npm ERR! syscall getaddrinfo npm ERR! errno ENOTFOUND npm ERR! network request to https://registry.npm.taobao.org/@vue%2fcli failed, reason: getaddrinfo ENOTFOUND proxy-server npm ERR! network This is a problem 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! Log files were not written due to an error writing to the directory: E:\Program Files\node.js\node_cache\_logs npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal C:\Users\lhq>npm config set registry http://registry.cnpmjs.org/ C:\Users\lhq>npm install -g @vue/cli npm ERR! code ENOTFOUND npm ERR! syscall getaddrinfo npm ERR! errno ENOTFOUND npm ERR! network request to http://registry.cnpmjs.org/@vue%2fcli failed, reason: getaddrinfo ENOTFOUND proxy-server npm ERR! network This is a problem 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! Log files were not written due to an error writing to the directory: E:\Program Files\node.js\node_cache\_logs npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
07-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值