[英]Npm “ENOTFOUND error” while installing ReactJs
我想安裝 ReactJs。我已經安裝了 Nodejs,然后嘗試創建 ReactJs 項目文件夾,我使用
npx create-react-app my-app根據 ReactJs 文檔但這是我得到的錯誤:-
npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.11.0.tgz failed, reason: getaddrinfo ENOTFOUND proxy.company.com
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! ..\_logs\2020-12-22T14_02_16_883Z-debug.log
Go轉
C:\Users\username
然后搜索
.npmrc
使用記事本打開.npmrc
文件並刪除所有內容和過去
http_proxy=http://domain:8080
這對我有用。
基於錯誤消息中的這一行:
npm ERR! network request to https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.11.0.tgz failed, reason: getaddrinfo ENOTFOUND proxy.company.com
...您已將proxy.company.com
設置為某處的代理。 找到它並將其修復為您實際需要的設置,或者如果您不需要代理(這是標准/典型情況)則將其刪除。 在后一種情況下,使用npm config delete proxy
,然后嘗試安裝。
也許您正在按照https://jjasonclark.com/how-to-setup-node-behind-web-proxy/或在其示例中使用proxy.company.com
的相關教程中的說明進行操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.