【问题标题】:npm ERR! FetchError: request to http://registry.npmjs.org/webpack-dev-server failed, reason: connect ECONNREFUSED 127.0.0.1:8000npm 错误! FetchError:对 http://registry.npmjs.org/webpack-dev-server 的请求失败,原因:连接 ECONNREFUSED 127.0.0.1:8000
【发布时间】:2020-01-28 23:09:09
【问题描述】:

我正在尝试使用npm 安装reactjs,并在无代理环境中使用我的PC。但是每当我使用npm install 命令时都会出现以下错误。我对此进行了很多搜索,但没有找到任何解决方案。请帮忙

npm install webpack webpack-dev-server --save-dev

错误是:

> npm ERR! code ECONNREFUSED
>     npm ERR! errno ECONNREFUSED
>     npm ERR! FetchError: request to http://registry.npmjs.org/webpack-dev-server failed, reason: connect
> ECONNREFUSED 127.0.0.1:8000
>     npm ERR!     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
>     npm ERR!     at ClientRequest.emit (events.js:188:13)
>     npm ERR!     at Socket.socketErrorListener (_http_client.js:399:9)
>     npm ERR!     at Socket.emit (events.js:188: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.internalTickCallback (internal/process/next_tick.js:72:19)
>     npm ERR!  { FetchError: request to http://registry.npmjs.org/webpack-dev-server failed, reason: connect
> ECONNREFUSED 127.0.0.1:8000
>     npm ERR!     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
>     npm ERR!     at ClientRequest.emit (events.js:188:13)
>     npm ERR!     at Socket.socketErrorListener (_http_client.js:399:9)
>     npm ERR!     at Socket.emit (events.js:188: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.internalTickCallback (internal/process/next_tick.js:72:19)
>     npm ERR!   message:
>     npm ERR!    'request to http://registry.npmjs.org/webpack-dev-server failed, reason: connect
> ECONNREFUSED 127.0.0.1:8000',
>     npm ERR!   type: 'system',
>     npm ERR!   errno: 'ECONNREFUSED',
>     npm ERR!   code: 'ECONNREFUSED',
>     npm ERR!   stack:
>     npm ERR!    'FetchError: request to http://registry.npmjs.org/webpack-dev-server failed, reason: connect
> ECONNREFUSED 127.0.0.1:8000\n    at ClientRequest.req.on.err
> (C:\\Program
> Files\\nodejs\\node_modules\\npm\\node_modules\\node-fetch-npm\\src\\index.js:68:14)\n
> at ClientRequest.emit (events.js:188:13)\n    at
> Socket.socketErrorListener (_http_client.js:399:9)\n    at Socket.emit
> (events.js:188:13)\n    at emitErrorNT
> (internal/streams/destroy.js:82:8)\n    at emitErrorAndCloseNT
> (internal/streams/destroy.js:50:3)\n    at
> process.internalTickCallback (internal/process/next_tick.js:72: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'

【问题讨论】:

    标签: javascript node.js reactjs npm webpack


    【解决方案1】:

    看起来它正在尝试连接到 localhost 而不是注册表。试试这个:

    npm config set proxy null
    npm config set https-proxy null
    npm config set registry http://registry.npmjs.org/
    

    【讨论】:

    • @prajwlr 值得一试。
    • 不工作。我已经尝试了所有可能的方法。强制清理、更新、删除、手动删除。没有任何效果
    猜你喜欢
    • 2019-08-09
    • 2020-09-14
    • 2021-02-03
    • 2023-01-26
    • 2019-11-02
    • 1970-01-01
    • 2018-07-04
    • 2018-10-26
    • 1970-01-01
    相关资源
    最近更新 更多