Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EPERM: operation not permitted, lstat when running ng build

I'm getting an ERROR when trying to run ng build on my angular 4 app.

EPERM: operation not permitted, lstat '<dist directory>'

Has anyone encountered this issue?

TIA

like image 950
Alvin Reyes Avatar asked Aug 12 '17 02:08

Alvin Reyes


People also ask

How do I fix NPM error Eperm Operation not permitted?

How do I fix error Eperm Operation not permitted? Run cmd as administrator Run npm config edit (You will get notepad editor) Change prefix variable to C:\Users\<User Name>\AppData\Roaming\npm Then npm start works in a normal console.


4 Answers

I had the same problem.

As @Mauricio De La Quintana said, the problem is permission.

In my case (Windows environment), I solved the problem by removing the read-only property from the Repos folder and adding write permission to the Everyone user.

like image 170
Maicon Heck Avatar answered Nov 11 '22 09:11

Maicon Heck


This probably a permission issue, just restart your IDE with admin permissions!

In my case I had to restart VsCode as administrator.

enter image description here

like image 8
Legends Avatar answered Nov 11 '22 07:11

Legends


This has happened in my ASP.NET projects. For me this has happened for one of two reasons.

  1. This can be a permission problem so you need to run Command Prompt as Admin.

    a. Press win to open the start menu. Type in cmd to search for Command Prompt.

    b. Press ctrl + shift + enter to launch Command Prompt as administrator.

  2. This can happen when you build your web project in Visual Studio(or another IDE) and it is currently running.

    a. This is a simple fix click the stop debugging and then try 'ng build' again.

like image 6
Braden Brown Avatar answered Nov 11 '22 08:11

Braden Brown


While running npm run build - I received error

Open Task Manager -> Select Chrome - > End Task -> Select VSCode -> End Task

Opened the Project again -> Run npm run Build ---> worked for me

like image 6
Arun Avatar answered Nov 11 '22 09:11

Arun