新的Mac用户我试图在phpstorm(laravel/laravel)中创建一个composer项目,但每次运行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
但似乎没有任何帮助。我已经尝试了这些线程中提供的所有解决方案,没有成功:
git 3359
git 17228
npm install hangs on idealTree
这可能是我的网络配置问题吗?就像我说的,我是菜鸟。有什么方法可以检查吗?
编辑:
我能够让它工作,通过降级到古代软件:
node 14.17.4
npm 6.14.14
这只是一个临时修复,我想知道如何使它与当前的软件版本。
2条答案
按热度按时间ws51t4hk1#
我有一个升级到v16节点后的一些问题。
删除
~/.npmrc
和~/.node/etc/npmrc
文件中的所有配置修复此问题。ljo96ir52#
在我的情况下,问题是互联网连接(网络安全组)。此外,如果你的ipv6是默认的,没有ipv6可用可能会导致这一点。因此,首先检查互联网连接,或者ping(如果允许的话),或者使用curl获取像https://registry.npmjs.org这样的地址,这是npm的存储库。