本文介绍了NPM命令创建-反应-应用失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在运行OSX Sierra 10.12.6的计算机(MBP PRO 2017)上测试reactjs。我关注了Facebook教程:
- 确保您安装了最新版本的Node.js。(完成)
- 按照安装说明创建新项目。https://facebook.github.io/react/docs/installation.html#creating-a-new-application
但我在第二步遇到了问题!
- 我没有在代理后面。
- 我的网络正常。
- 存储库设置为registry.npmjs.org
- 我可以读取URL:https://registry.npmjs.org/create-react-app
- 但即使在外部DNS上也找不到此域wsg.intra.corp.grp
我被困住了,任何帮助都会很好!
$ npm install -g create-react-app
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND wsg.intra.corp.grp wsg.intra.corp.grp:8080
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! ~/.npm/_logs/2017-09-01T08_15_13_521Z-debug.log
和日志文件:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'create-react-app' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 4811d091ad74f9ef
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for create-react-app@latest request to https://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND wsg.intra.corp.grp wsg.intra.corp.grp:8080
8 verbose type system
9 verbose stack FetchError: request to https://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND wsg.intra.corp.grp wsg.intra.corp.grp:8080
9 verbose stack at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
9 verbose stack at emitOne (events.js:115:13)
9 verbose stack at ClientRequest.emit (events.js:210:7)
9 verbose stack at onerror (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/index.js:106:9)
9 verbose stack at callbackError (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/index.js:126:5)
9 verbose stack at <anonymous>
9 verbose stack at process._tickCallback (internal/process/next_tick.js:188:7)
10 verbose cwd /Users/franckfournier/PycharmProjects/projectX/react
11 verbose Darwin 16.7.0
12 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "create-react-app"
13 verbose node v8.4.0
14 verbose npm v5.3.0
15 error code ENOTFOUND
16 error errno ENOTFOUND
17 error network request to https://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND wsg.intra.corp.grp wsg.intra.corp.grp:8080
18 error network This is a problem related to network connectivity.
18 error network In most cases you are behind a proxy or have bad network settings.
18 error network
18 error network If you are behind a proxy, please make sure that the
18 error network 'proxy' config is set properly. See: 'npm help config'
19 verbose exit [ 1, true ]
推荐答案
您似乎在公司代理后面,正如日志中提到的wsg.intra.corp.grp:8080
。
您需要配置代理,如this guide所示。
希望这能有所帮助!
这篇关于NPM命令创建-反应-应用失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!