Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An unexpected error occurred: "EPERM: operation not permitted in Yarn

Tags:

npm

yarnpkg

I am having problems installing new npm packages with Yarn. Every time I go on to add a new package it's throwing me this error. But when I delete my node_modules folder and run Yarn, everything works fine. Again when I try to add another package, it throws me the same error. Any solutions, I am having a headache right now.

enter image description here

like image 346
Pranta Avatar asked Oct 30 '20 07:10

Pranta


5 Answers

In Windows first stop the development server and then try to install package.

like image 71
Jaimin Bhut Avatar answered Nov 17 '22 08:11

Jaimin Bhut


I had same problem, I went into the Task Manager (CTRL+SHIFT+ESC) and killed all the NodeJs processes.

like image 21
PLT Avatar answered Nov 17 '22 08:11

PLT


Stopping the server before running yarn add solved mine.

like image 21
Pope Francis Avatar answered Nov 17 '22 08:11

Pope Francis


Press "Ctrl+C" to stop the server and repeat the installation.

like image 10
Nawfel Hamdi Avatar answered Nov 17 '22 08:11

Nawfel Hamdi


if you're using visual studio code, cmd, or Windows Terminal, close it and run it in administrator mode. Usually, the reason for that error message is a result of limited privilege giving to the editor or npm or Yarn if you're using that.

like image 4
Peter Avatar answered Nov 17 '22 08:11

Peter