Home > Blockchain >  Cannot run npm build in ubuntu, AWS EC2. Error: [eslint] EACCES: permission denied, mkdir '/hom
Cannot run npm build in ubuntu, AWS EC2. Error: [eslint] EACCES: permission denied, mkdir '/hom

Time:10-04

I'm trying to deploy my first MERN app through AWS EC2. It has been quite the learning experience. After following a few blog posts I figured out how to get the backend running, but I am struggling to get the front end to work.

I realize this is some permission-related issue but for the life of me I can't find any method online to fix this. Essentially I will submit "npm run build" in the ubuntu aws terminal and I recieve this error everytime. Any advice would be appreciated.

$ sudo npm run build

> [email protected] build
> react-scripts build

Creating an optimized production build...
Failed to compile.

[eslint] EACCES: permission denied, mkdir '/home/ubuntu/blog-api/client/node_modules/.cache'

CodePudding user response:

Change the permission of the folder blog-api to the current user using chown.

$ sudo chown -R $USER:$USER /home/ubuntu/blog-api

and then run npm run build.

  • Related