每当我运行lerna bootstrap --hoistlerna bootstrap时,我在Windows机器上都会收到以下错误。

我已经尝试过npm login并强制清除了npm缓存,但似乎没有任何效果。

npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'E:\Devfolio_work\ethglobal-devfolio\node_modules\.staging\typescript-ebd093cf\lib\typescriptServices.js'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'E:\Devfolio_work\ethglobal-devfolio\node_modules\.staging\typescript-ebd093cf\lib\typescriptServices.js']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'E:\Devfolio_work\ethglobal-devfolio\node_modules\.staging\typescript-ebd093cf\lib\typescriptServices.js'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'E:\\Devfolio_work\\ethglobal-devfolio\\node_modules\\.staging\\typescript-ebd093cf\\lib\\typescriptServices.js' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'E:\\Devfolio_work\\ethglobal-devfolio\\node_modules\\.staging\\typescript-ebd093cf\\lib\\typescriptServices.js\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'E:\\Devfolio_work\\ethglobal-devfolio\\node_modules\\.staging\\typescript-ebd093cf\\lib\\typescriptServices.js',
npm ERR!   parent: 'root' }
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).

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\hp\AppData\Roaming\npm-cache\_logs\2019-01-09T16_55_24_342Z-debug.log


lerna.json

{
  "packages": [
    "packages/*"
  ],
  "version": "independent"
}




我的环境



lerna --version 3.5.1

npm --version 6.4.1

node --version 10.5.0

操作系统版本

视窗10 1709

最佳答案

我终于找到了解决方案,这似乎是Windows的问题,只需在当前工作目录中的admin命令提示符下运行此命令即可。

10-08 00:24