0

I'm facing this issue since very long tried almost all solutions available on Stackoverflow but not able to resolve. Tried changing permissions, reinstalling node, changing directory of npm modules but nothing seems to workout .

pajoshi2@PAJOSHI2-M-R5TQ .npm-global % npm install -g jshint                
npm ERR! code EROFS
npm ERR! syscall mkdir
npm ERR! path /npm
npm ERR! errno -30
npm ERR! rofs EROFS: read-only file system, mkdir '/npm'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.

4 Answers4

1

Issue got resolved
The .npmrc file was having some entry related to .npm_cache whose location was pointing to some directory which didn't exist. So,deleting that entry and running npm cache clean --force solved my issue.

0

Try running following command. Helps me out when node modules are corrupted or giving error:

sudo rm -rf node_modules && npm rebuild node-sass && npm i

Also Update the folder permissions using the following steps:
  • Open project root directory
  • Right click anywhere and click on Get Info. A popup will open
  • Open Sharing and Permissions at the end of the popup
  • Click on the lock icon
  • Give password
  • Now again try running the npm command
AhmerMH
  • 638
  • 7
  • 18
  • `npm ERR! correctMkdir failed to make directory /npm/_locks` `npm ERR! code EROFS` `npm ERR! syscall mkdir` getting error even in running above command – Pankaj Joshi Oct 06 '20 at 05:08
  • Looks like the write permissions are off. If you are working in your local please try following: `sudo chmod -R 777 `. This will provide permissions to the current folder and give permissions to child folders as well. – AhmerMH Oct 06 '20 at 05:12
  • I have also tried changing permission still no luck : ( – Pankaj Joshi Oct 06 '20 at 05:14
  • I have updated the answer for permission. Please try that. – AhmerMH Oct 06 '20 at 05:21
  • Check this question here: https://stackoverflow.com/questions/60020217/npm-error-error-erofs-read-only-file-system-mkdir-npm. This one has the same issue the one you are facing. – AhmerMH Oct 06 '20 at 07:42
0

Try the following command

sudo chown -R <your_user>:staff ~/.npm
sudo chmod 755 ~/.npm
sudo chown -R <your_user>:wheel /usr/local/lib/node_modules
sudo chmod 755 /usr/local/lib/node_modules
Shawn Ang
  • 538
  • 7
  • 21