gpt4 book ai didi

node.js - 将 Node 从 6 升级到最新版本时,npm i 在 React Native 项目中因 ENOENT 而失败

转载 作者:行者123 更新时间:2023-12-05 05:47:56 30 4
gpt4 key购买 nike

在 React Native 项目上将 npm 从 6.14 升级到最新版本时

使用 Node 14、nvm 切换 Node 版本,理想情况下我想转到 Node 16,但特别是在更新 npm 时,无论是 14 还是 16,都会发生类似的问题。

我也在 mac M1 上使用自制软件

我注意到 Jetify 命令询问我:

Jetifier 找到了 1390 个要转发到 Jetify 的文件。使用8名 worker ...需要安装以下包:荚确定继续吗? (y)

当我选择 y 时,npm i 失败。我已经清除了缓存并删除了 node_modules。正常的缓存清除尝试似乎不起作用。

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2022-01-28T21_51_28_303Z-debug-0.log
npm ERR! code 254
npm ERR! path /Users/user/repos/MyApp/My-MobileApp
npm ERR! command failed
npm ERR! command sh -c npx jetify && cd ios && npx pod install && cd .. && ./node_modules/.bin/patch-package

这是完整日志的一部分-

    3325 timing reify:rollback:retireShallow Completed in 0ms
3326 timing command:exec Completed in 42372ms
3327 verbose stack Error: ENOENT: no such file or directory, chmod '/Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2'
3328 verbose cwd /Users/user/repos/MyApp/MyApp-MobileApp/ios
3329 verbose Darwin 21.2.0
3330 verbose argv "/Users/user/.nvm/versions/node/v14.18.3/bin/node" "/Users/user/.nvm/versions/node/v14.18.3/lib/node_modules/npm/bin/npm-cli.js" "exec" "--" "pod" "install"
3331 verbose node v14.18.3
3332 verbose npm v8.4.0
3333 error code ENOENT
3334 error syscall chmod
3335 error path /Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2
3336 error errno -2
3337 error enoent ENOENT: no such file or directory, chmod '/Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2'
3338 error enoent This is related to npm not being able to find a file.
3338 error enoent
3339 verbose exit -2
3340 timing npm Completed in 42533ms
3341 verbose unfinished npm timer reify 1643406718315
3342 verbose unfinished npm timer reify:build 1643406730346
3343 verbose unfinished npm timer build 1643406730346
3344 verbose unfinished npm timer build:deps 1643406730347
3345 verbose unfinished npm timer build:link 1643406730354
3346 verbose unfinished npm timer build:link:node_modules/pod 1643406730356
3347 verbose code -2
3348 error A complete log of this run can be found in:
3348 error /Users/user/.npm/_logs/2022-01-28T21_51_28_303Z-debug-0.log

最佳答案

看起来错误与没有从 pod 依赖项中找到 pm2 包有关。

不确定这是否适用于 npx,您可能需要全局安装 pod 才能使其正常工作。

npm install pod -g
pod install // instead of npx pod install

https://www.npmjs.com/package/pod#installation

关于node.js - 将 Node 从 6 升级到最新版本时,npm i 在 React Native 项目中因 ENOENT 而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70900791/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com