Post

Replies

Boosts

Views

Activity

Reply to Error: EPERM: operation not permitted
Hi, It's been 3 years to this Question and there isn't a clear solution to this over the internet. Maybe its too easy but I struggled with this for the last couple of hours and thought my answer here would help anyone who has a similar problem.. The issue started with - % npm config set prefix /usr/loca As you can notice from the above, I forgot the letter 'l' at the end of the line leading to npm config setting my 'prefix' to /usr/loca [this is my understanding of the issue. Feel free to correct me as I am new to Node world] Now, when I try and run - % npx create-react-app myApp I got an error as - Error: EPERM: operation not permitted, mkdir '/usr/loca' Because there is no directory by name 'loca'. Few suggestions about disabling SIP to make it work are there but I think it's not a good idea. Anyway, here are the steps I took to resolve the issue - Step 1 : On your terminal get into root account by typing -- sudo -i Step 2: Enter your root credential password Step 3: Clear npm cache by force -- npm cache clean --force Step 4: Install latest npm -- npm install -g npm@latest --force Step 5: Clear npm cache again -- npm cache clean --force Step 6: You should be good now. Check your npm version -- rpm -v Step 7: 'exit' out of root Step 8: Set prefix properly this time -- npm config set prefix /usr/local Step 9: npx create-react-app client Step 10: Type 'Y' to install create-react-app package If everything went well, you should see a 'Happy Hacking' message as the last line. Hope this helps.
Mar ’21