我无法在一个有角度的项目中安装npm。安装几乎完成,但失败
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\workspaces\my-project\my-module\node_modules\.staging\typescript-d1902bf5\lib\typescriptServices.js
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\workspaces\my-project\my-module\node_modules\.staging\typescript-d1902bf5\lib\typescriptServices.js'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'C:\workspaces\my-project\my-module\node_modules\.staging\typescript-d1902bf5\lib\typescriptServices.js'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'C:\workspaces\my-project\my-module\node_modules\.staging\typescript-d1902bf5\lib\typescriptServices.js'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\workspaces\\my-project\my-module\\node_modules\\.staging\\typescript-d1902bf5\\lib\\typescriptServices.js'
npm ERR! },
npm ERR! stack: "Error: EPERM: operation not permitted, unlink 'C:\\workspaces\\my-project\my-module\\node_modules\\.staging\\typescript-d1902bf5\\lib\\typescriptServices.js'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\workspaces\\my-project\my-module\\node_modules\\.staging\\typescript-d1902bf5\\lib\\typescriptServices.js',
npm ERR! parent: 'my-module'
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.
我尝试过的事情:
npm i -g npm
,npm install
卸载Windows的nvm并安装nodejs 12.13.0 LTS npm cache verify
,npm install
npm cache clean --force
,npm install
有人可以建议我可能没有想到的事情吗?不幸的是,我无法发布package.json或.npmrc,因为我正在使用的存储库不是公开的,但是从错误的外观来看,这应该是不相关的。
更新
看来这可能是比赛条件。参见here。我正在使用npm 6.13.0版本。
另一个更新
我现在还有其他问题,但乔纳森·欧文(Jonathan Irvin)的评论对我有帮助,尤其是this。我禁用了Windows索引编制并将所有权限授予了我的用户。
答案 0 :(得分:0)
在项目的根目录上尝试npm unlink
。