当节点从6升级到最新版本时,npm i在react原生项目中使用ENOENT失败



在react原生项目上从6.14升级到新版本的npm时

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

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

我注意到Jetify命令问我:

Jetifier找到1390个文件来转发jetify。使用8名工人。。。需要安装以下软件包:豆荚可以继续吗?(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

尝试他们说要使用的npm rebuild;只有当您升级节点版本并且必须重新编译">

你好,我曾经遇到过这种类型的问题,实际上是因为在更新的节点版本中找不到应用程序中使用的旧节点上的pm2或其他包或进程在代码中重新安装pm2包和旧节点使用的其他包,然后重试

如果这对你有帮助,请告诉我

最新更新