Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
905 views
in Technique[技术] by (71.8m points)

npm - Error: EPERM: operation not permitted, unlink 'D:Sources** ode_modulesfsevents ode_modulesabbrevpackage.json'

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

D:SourcesDownloadCmsMd.DownloadWeb.Angular>npm install mds.angular.datetimepicker@latest --save
npm ERR! path D:SourcesDownloadCmsMd.DownloadWeb.Angular
ode_modulesfsevents
ode_modulesabbrevpackage.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:SourcesDownloadCmsMd.DownloadWeb.Angular
ode_modulesfsevents
ode_modulesabbrevpackage.json'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, unlink 'D:SourcesDownloadCmsMd.DownloadWeb.Angular
ode_modulesfsevents
ode_modulesabbrevpackage.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'
    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:UsersMohammadAppDataRoaming
pm-cache\_logs2017-09-03T03_25_50_432Z-debug.log

I'm dead sure, run CMD as administrator.

Also I checked D:SourcesDownloadCmsMd.DownloadWeb.Angular ode_modulesfsevents ode_modulesabbrevpackage.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 :-(

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...