将react本地项目上的节点和npm从npm 6更新到8以及将节点14更新到16或18在ENOENT上失败



运行npm安装后出现错误,

似乎npm的路径不对,或者缓存了什么?

我使用自制软件和nvm在版本之间切换,但唯一有效的版本是node14和npm6。

需要安装以下软件包:pod@0.9.0可以继续吗?(y( y

npm ERR! syscall chmod
npm ERR! path /Users/me/.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/me/.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/me/.npm/_logs/2022-08-04T19_23_48_147Z-debug-0.log
npm ERR! code 254
npm ERR! path /Users/me/repos/MyApp/MyMobileApp
npm ERR! command failed
npm ERR! command sh /var/folders/d2/rdhvx2fd24vbsfrtf3lddq9m0000gq/T/postinstall-a0c95179.sh
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2022-08-04T19_23_45_192Z-debug-0.log

```. i get User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
error: Could not delete `/Users/me/repositories/MyApp/ios/build` because it was not created by the build system.
note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true /Users/me/repositories/MyApp/ios/build` when it is created.
error: Could not delete `/Users/me/repositories/MyApp/ios/build` because it was not created by the build system.
note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true /Users/me/repositories/MyApp/ios/build` when it is created.
** CLEAN FAILED **

现在是我运行xcodebuild-alltargets清理时发生的事情吗

这可能是由于缓存造成的。尝试下面的步骤并检查它是否工作

  1. 运行rm -rf ~/.npm
  2. 运行npm cache clean --force
  3. 删除node_modules(运行rm -rf node_modules(
  4. 删除package-lock.json(运行rm -rf package-lock.json(

npm安装与对等依赖冲突时,就会发生这种情况

--在安装时忽略所有对等依赖关系的遗留对等deps。

因此,最好的方法是使用传统的对等deps

npm install --legacy-peer-deps

最新更新