The operation was rejected by your operating system

Today, using node.js package vue time reported the problem

npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path D:\pbs_workspace\web-vue\node_modules\.staging\echarts-2a49d5e4\dist\echarts.js.map
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\pbs_workspace\web-vue\node_modules\.staging\echarts-2a49d5e4\dist\echarts.js.map'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'D:\pbs_workspace\web-vue\node_modules\.staging\echarts-2a49d5e4\dist\echarts.js.map'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'D:\pbs_workspace\web-vue\node_modules\.staging\echarts-2a49d5e4\dist\echarts.js.map'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'D:\\pbs_workspace\\web-vue\\node_modules\\.staging\\echarts-2a49d5e4\\dist\\echarts.js.map'        
npm ERR!   },
npm ERR!   stack: "Error: EPERM: operation not permitted, unlink 'D:\\pbs_workspace\\web-vue\\node_modules\\.staging\\echarts-2a49d5e4\\dist\\echarts.js.map'",
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'D:\\pbs_workspace\\web-vue\\node_modules\\.staging\\echarts-2a49d5e4\\dist\\echarts.js.map',
npm ERR!   parent: 'web-vue'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

After a review of Baidu has provided solutions are as follows:
need to delete npmrc file.
He stressed: nodejs not install the files in the directory npmrc npm module
but in C: \ Users {account} \ file under .npmrc

Then the question again, so where is this .npmrc file in it?
I was full-text search on this computer, a query for a long time, the result was nothing, and then query on .npmrc documents related
queries npmrc path can enter the following command

npm config ls -l 

Here Insert Picture Description
Then I went to the folder to find it and found no
just another run of the edit command If not, then the editor is empty,

npm config edit 

Then pop-up text files, view text files in the directory address I found consistent with the above
and then turn to the next account in the user query under the c drive, this time there, and then delete the file and execute it clear cache command

npm cache clean --force

Then pack

npm install

====================== Method Two

Ide shut down the program, and then delete all the files in the node_modules, then npm install, if not enough, you can turn off the antivirus software

Method three ======================
we sometimes pull someone else's package-lock.json file on git, direct npm install may install an error, prompting package breakage and the like, and then install the entire package under / node_modules / file because of the lack of package failed to install.

1. Empty npm agent

npm config rm proxy
npm config rm https-proxy

2. Empty cache npm

npm cache clean -f

3. Delete package-lock.json directly

npm install

.Npmrc under 4. Delete the user directory
as long as you had configured in npm command line parameters, such as

npm config set registry https://registry.npm.taobao.org

The document will be generated in the user directory

Not so that. Eventually there will be damage to the bags of the installation does not go. In fact, I did not think the easiest way is to find damaged files, separate installation

npm install **@X.Y.Y

Published 170 original articles · won praise 13 · views 10000 +

Guess you like

Origin blog.csdn.net/G_whang/article/details/104248929