【发布时间】:2019-01-02 21:26:57
【问题描述】:
我不小心在我的终端 npm set registry 上运行了这个命令:
http://localhost:4873/https://www.npmjs.com/package/react-native-cli
在探索 react-native 时,它现在与我的 create-react-app yarn 命令(创建反应启动器应用程序)搞砸了,我知道这一点,因为我收到了这个错误
FetchError:对http://localhost:4873/yarn 的请求失败,原因:连接 ECONNREFUSED 127.0.0.1:4873 ...
关于如何修复它的任何建议。我的版本npm、yarn、node
- npm -v6.4.1
- 节点 v10.14.2
- yarn v1.12.3
- brew v1.8.6 homebrew-core#cdd30, homebrew-cask#580d7
这是我尝试重新安装 create-react-app cli 时的完整错误代码
npm install -g create-react-app yarn
Password:
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to http://localhost:4873/yarn failed, reason: connect ECONNREFUSED 127.0.0.1:4873
npm ERR! at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
npm ERR! at ClientRequest.emit (events.js:182:13)
npm ERR! at Socket.socketErrorListener (_http_client.js:392:9)
npm ERR! at Socket.emit (events.js:182:13)
npm ERR! at emitErrorNT (internal/streams/destroy.js:82:8)
npm ERR! at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
npm ERR! at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! { FetchError: request to http://localhost:4873/yarn failed, reason: connect ECONNREFUSED 127.0.0.1:4873
npm ERR! at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
npm ERR! at ClientRequest.emit (events.js:182:13)
npm ERR! at Socket.socketErrorListener (_http_client.js:392:9)
npm ERR! at Socket.emit (events.js:182:13)
npm ERR! at emitErrorNT (internal/streams/destroy.js:82:8)
npm ERR! at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
npm ERR! at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! message:
npm ERR! 'request to http://localhost:4873/yarn failed, reason: connect ECONNREFUSED 127.0.0.1:4873',
npm ERR! type: 'system',
npm ERR! errno: 'ECONNREFUSED',
npm ERR! code: 'ECONNREFUSED',
npm ERR! stack:
npm ERR! 'FetchError: request to http://localhost:4873/yarn failed, reason: connect ECONNREFUSED 127.0.0.1:4873\n at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)\n at ClientRequest.emit (events.js:182:13)\n at Socket.socketErrorListener (_http_client.js:392:9)\n at Socket.emit (events.js:182:13)\n at emitErrorNT (internal/streams/destroy.js:82:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)\n at process._tickCallback (internal/process/next_tick.js:63:19)' }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
【问题讨论】:
-
您有
~/.npmrc文件吗?我认为您无法撤消对设置注册表的更改,但您可以删除该文件以将其重置为默认值。
标签: reactjs npm command-line-interface yarnpkg