Kim Kablitz
Kim Kablitz

Reputation: 11

create-react-app command fails, how to undo a npm set registry command

I accidentally run this command on my terminal npm set registry:

while exploring react-native and it has now messed up with my create-react-app yarn command (to create a react starter app) I know this because I get this error

FetchError: request to http://localhost:4873/yarn failed, reason: connect ECONNREFUSED 127.0.0.1:4873 ...

Any suggestions on how to fix it. My versions npm, yarn, node

Here is the full error code when I try to reinstall the 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:

Upvotes: 1

Views: 1650

Answers (2)

Market
Market

Reputation: 450

I got similar issue, I have register http (not secure). Works for me.

$ npm config set registry http://registry.npmjs.org/
$ npm config set strict-ssl false

Upvotes: 1

jered
jered

Reputation: 11581

Try deleting ~/.npmrc, if it exists. When you run npm set registry it typically saves the setting to that file.

Upvotes: 0

Related Questions