当我尝试运行命令时
npm install http
在给我这个错误之前它挂起了一段时间
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to https://localhost/http failed, reason:
npm ERR! at ClientRequest.<anonymous> (C:\Users\Barth\AppData\Roaming\npm\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR! at ClientRequest.emit (node:events:514:28)
npm ERR! at _destroy (node:_http_client:875:13)
npm ERR! at onSocketNT (node:_http_client:895:5)
npm ERR! at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! FetchError: request to https://localhost/http failed, reason:
npm ERR! at ClientRequest.<anonymous> (C:\Users\Barth\AppData\Roaming\npm\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR! at ClientRequest.emit (node:events:514:28)
npm ERR! at _destroy (node:_http_client:875:13)
npm ERR! at onSocketNT (node:_http_client:895:5)
npm ERR! at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
npm ERR! code: 'ECONNREFUSED',
npm ERR! errno: 'ECONNREFUSED',
npm ERR! type: 'system',
npm ERR! requiredBy: '.'
npm ERR! }
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'
如您所见,它尝试从 https://localhost/http 安装它 是什么导致了这个问题以及如何解决这个问题
我已经尝试完全重新安装节点
确保您的 npm 注册表设置正确。您可以使用以下命令检查和更新注册表:
npm config get registry
npm config set registry https://registry.npmjs.org/
我希望这对其他人也有帮助。