问题如下:
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/