Getting an error after running npm install,
It seems that npm is not pathed right for this file or something is cached?
I’m using homebrew and nvm to switch between versions, but the only version that works is node 14 and npm 6.
Need to install the following packages:
[email protected]
Ok to proceed? (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 **
Is now something that happens when I run xcodebuild -alltargets clean
2
Answers
It happens when npm install conflict with peer dependencies
–legacy-peer-deps that ignores all peer dependencies when installing.
So the best approch is to use –legacy-peer-deps
This may be due to cache. Try below step and check if it works
rm -rf ~/.npm
npm cache clean --force
node_modules
(runrm -rf node_modules
)package-lock.json
(runrm -rf package-lock.json
)