reactjs - create-react-app 命令失败,如何撤消 npm set registry 命令
问题描述
我不小心在我的终端 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
- 纱线 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:
解决方案
我遇到了类似的问题,我已经注册http
(不安全)。为我工作。
$ npm config set registry http://registry.npmjs.org/
$ npm config set strict-ssl false
推荐阅读
- android - Android - 屏幕键盘的语言
- regex - 如何使用 CURL 运行 GraphQL 搜索查询(使用正则表达式)?
- json - 如何在 SpringBoot 中将 JSON 请求体转换为 SOAP 请求体?
- c - 是否有必要在 for 循环之外有一个 return 语句?在外面返回,我没有错误
- visual-studio-code - 如何在 Vs 代码中更改源代码控制的背景?
- typescript - 为什么从 TypeScript 接口中删除只读?
- flutter - 在 Flutter 中验证越南语名称
- dart - Dart:假设来自 T 函数(TModel 模型)表达式的泛型类型
- spring - Jackson/ObjectMapper:表达式语言注入和“${...}”
- prestashop - smarty 分配属性在 ps 1.6 中工作,但在 1.7 版本中没有