npm 报错:operation not permitted, The operation was rejected by your operating system.

具体报错如下:

npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Dao\Desktop\vue-element-admin\vue-element-admin\node_modules\.staging\echarts-7bd35471\map\js\province\jilin.js'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'C:\Users\Dao\Desktop\vue-element-admin\vue-element-admin\node_modules\.staging\echarts-7bd35471\map\js\province\jilin.js']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'C:\Users\Dao\Desktop\vue-element-admin\vue-element-admin\node_modules\.staging\echarts-7bd35471\map\js\province\jilin.js'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'C:\\Users\\Dao\\Desktop\\vue-element-admin\\vue-element-admin\\node_modules\\.staging\\echarts-7bd35471\\map\\js\\province\\jilin.js' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'C:\\Users\\Dao\\Desktop\\vue-element-admin\\vue-element-admin\\node_modules\\.staging\\echarts-7bd35471\\map\\js\\province\\jilin.js\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'C:\\Users\\Dao\\Desktop\\vue-element-admin\\vue-element-admin\\node_modules\\.staging\\echarts-7bd35471\\map\\js\\province\\jilin.js',
npm ERR!   parent: 'vue-element-admin' }
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 (though this is not recommended).

实践了网上的所有方法之后还是不起作用,最后更改为 yarn 来 install.

1. 安装 yarn 可以使用三种方式安装

1. 下载 .msi 文件安装
2. 通过 Chocolatey 安装
   需要先安装 Chocolatey : 控制台执行            
   @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
   执行完之后执行 choco install yarn 
3. 通过 Scoop 安装 :控制台执行
   iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
   执行完之后执行:scoop install yarn

 

 

 

你可能感兴趣的:(npm)