skip to Main Content

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


  1. 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

    npm install --legacy-peer-deps
    
    Login or Signup to reply.
  2. This may be due to cache. Try below step and check if it works

    1. Run rm -rf ~/.npm
    2. Run npm cache clean --force
    3. Remove node_modules (run rm -rf node_modules)
    4. Remove package-lock.json (run rm -rf package-lock.json)
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search