Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: EPERM: operation not permitted, unlink 'D:\Sources\**\node_modules\fsevents\node_modules\abbrev\package.json'

I just updated npm to 5.4.0.
Now, Whenever I want install a npm package I get the following error:

D:\Sources\DownloadCms\Md.Download\Web.Angular>npm install mds.angular.datetimepicker@latest --save npm ERR! path D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules\fsevents\node_modules\abbrev\package.json npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall unlink npm ERR! Error: EPERM: operation not permitted, unlink 'D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules\fsevents\node_modules\abbrev\package.json' npm ERR!     at Error (native) npm ERR!  { Error: EPERM: operation not permitted, unlink 'D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules\fsevents\node_modules\abbrev\package.jso n' npm ERR!     at Error (native) npm ERR!   stack: 'Error: EPERM: operation not permitted, unlink \'D:\\Sources\\DownloadCms\\Md.Download\\Web.Angular\\node_modules\\fsevents\\node_modules\\ab brev\\package.json\'\n    at Error (native)', npm ERR!   errno: -4048, npm ERR!   code: 'EPERM', npm ERR!   syscall: 'unlink', npm ERR!   path: 'D:\\Sources\\DownloadCms\\Md.Download\\Web.Angular\\node_modules\\fsevents\\node_modules\\abbrev\\package.json' } npm ERR! npm ERR! Please try running this command again as root/Administrator.  npm ERR! A complete log of this run can be found in: npm ERR!     C:\Users\Mohammad\AppData\Roaming\npm-cache\_logs\2017-09-03T03_25_50_432Z-debug.log 

I'm dead sure, run CMD as administrator.

Also I checked D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules\fsevents\node_modules\abbrev\package.json\, package.json is not exist in path !

Edit: Upgrade to v5.4.1, still get the same error, even cannot work around with --no-optional :-(

like image 828
Mohammad Dayyan Avatar asked Sep 03 '17 03:09

Mohammad Dayyan


People also ask

How do I unlink a node module?

Just run npm unlink --no-save <module_name> on your project's directory to remove the local symlink, and run npm unlink on the module's directory to remove the global symlink.

What is the use of npm install command?

npm install command: This npm command is used for installing the third party modules in our current directory.


2 Answers

I was able to fix this by running the command prompt/bash as admin and closing VSCode! Seems like VSCode was locking some files. Potentially something else could be locking these files for you.

like image 176
Mark Whitfeld Avatar answered Oct 11 '22 05:10

Mark Whitfeld


It is an npm 5.4.0 issue https://github.com/npm/npm/issues/18287

Workarounds are

  • downgrade to 5.3
  • try running with --no-optional, i.e. npm install --no-optional
like image 41
hidden_4003 Avatar answered Oct 11 '22 05:10

hidden_4003