在終端執(zhí)行 npm install時棕兼,出現(xiàn)以下類似的報錯時
npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to http:/ /registry.cnpmjs.org/yarn 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! E:\nodejs\node_cache\_logs\2022-06-06T08_36_56_243Z-debug.log
解決方法如下所示:
- 在cmd終端輸入以下命令伴挚,作用是設(shè)置代理
npm config set proxy=
- 2.然后使用淘寶鏡像
npm config set registry https://registry.npm.taobao.org
- 下載所需要的包
eg:npm install -g jquery
jquery 這部分就是所需要的包