【发布时间】:2022-02-21 12:35:37
【问题描述】:
这里是新的 mac 用户。我正在尝试在 phpstorm (laravel/laravel) 中创建一个作曲家项目,但每次我运行 npm install 时,进程都会卡在:
npm timing idealTree:userRequests Completed in 0ms
⸨⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⸩ ⠸ idealTree:stuttard_staging: sill idealTree buildDeps
完整的错误报告(大约 10 分钟冻结后):
npm timing idealTree:buildDeps Completed in 1181143ms
npm timing idealTree:fixDepFlags Completed in 1ms
npm timing idealTree Completed in 1181150ms
npm timing command:i Completed in 1181156ms
npm verb type system
npm verb stack FetchError: request to http://registry.npmjs.org/axios failed, reason: connect ETIMEDOUT 2606:4700::6810:1123:80
npm verb stack at ClientRequest.<anonymous> (/opt/homebrew/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:110:14)
npm verb stack at ClientRequest.emit (node:events:390:28)
npm verb stack at Socket.socketErrorListener (node:_http_client:447:9)
npm verb stack at Socket.emit (node:events:402:35)
npm verb stack at emitErrorNT (node:internal/streams/destroy:164:8)
npm verb stack at emitErrorCloseNT (node:internal/streams/destroy:129:3)
npm verb stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm verb cwd /Users/artur/PhpstormProjects/stuttard_staging
npm verb Darwin 20.6.0
npm verb argv "/opt/homebrew/Cellar/node/17.2.0/bin/node" "/opt/homebrew/bin/npm" "i" "--verbose"
npm verb node v17.2.0
npm verb npm v8.1.4
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to http://registry.npmjs.org/axios failed, reason: connect ETIMEDOUT 2606:4700::6810:1123:80
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm verb exit 1
npm timing npm Completed in 1181269ms
npm verb unfinished npm timer reify 1638537601466
npm verb unfinished npm timer reify:loadTrees 1638537601470
npm verb code 1
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/artur/.npm/_logs/2021-12-03T13_39_42_628Z-debug.log
这个问题似乎在节点版本14+ 中存在多年。我将node 17.2 与npm 8.1.4 一起使用,但似乎仍然可以理解。有些线程告诉删除我没有的package-lock.json 文件夹。
我已尝试配置注册表:
npm config set registry http://registry.npmjs.org/
或清除缓存:
npm cache clear --force
但似乎没有任何帮助。我已经尝试了这些线程中提供的所有解决方案,但均未成功:
npm install hangs on idealTree
这可能是我的网络配置有问题吗?正如我所说,我是mac noob。有什么办法查吗?
编辑:
我能够通过降级到古老的软件来让它工作:
node 14.17.4
npm 6.14.14
这只是一个临时修复,我很想知道如何使它适用于当前的软件版本。
【问题讨论】:
-
由于某种原因,我在使用 npm 时经常遇到诸如此类的错误。我使用 yarn,因为我无法完全解决我通过 npm 收到的网络错误。 Perharps 试试纱线。
-
@silencedogood 在 Windows
npm上运行良好,但如果在 mac 上继续发生这种情况,我可能会给yarn一个机会。 -
@silencedogood 嘿,我只想说我现在正在使用
yarn,它效果很好,而且比npm更快。谢谢
标签: node.js npm npm-install