Home > Software design >  Permission Denied by System -- mkdir node_modules (MacOS - Monterey)
Permission Denied by System -- mkdir node_modules (MacOS - Monterey)

Time:11-11

I can't seem to get around this problem... I've tried uninstalling node completely and reinstalling, cleaning the npm cache, reinstalling the packages (Angular CLI), running sudo chown -R franfonse ../Programming , but this problem keeps happening.

I try running ng new my-app to create a new project with Angular CLI, and this is what I keep getting:

npm ERR! syscall mkdir
npm ERR! path /Users/franfonse/Desktop/Programming/my-app/node_modules
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, mkdir '/Users/franfonse/Desktop/Programming/my-app/node_modules'
npm ERR!  [Error: EPERM: operation not permitted, mkdir '/Users/franfonse/Desktop/Programming/my-app/node_modules'] {
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/Users/franfonse/Desktop/Programming/my-app/node_modules'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/franfonse/.npm/_logs/2021-11-10T08_54_24_926Z-debug.logPackage install failed, see above.
The Schematic workflow failed. See above.

Does anyone have any idea on how to fix this issue?

I'd appreciate it SO much.

CodePudding user response:

Try this command: npm set prefix 'C:\Users\User\AppData\Roaming\npm'

If you have already set this value run the above command again after deleting the prefix.

CodePudding user response:

SOLVED:

I just installed the latest version of Node.js from the official website. I've been using Home-brew to upgrade and install node, but apparently something was not working through that.

Just install Node.js through official website.

  • Related