无法安装 angular-cli:EPERM -4048 unlink [英] Unable to install angular-cli: EPERM -4048 unlink

查看:21
本文介绍了无法安装 angular-cli:EPERM -4048 unlink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试通过 npm 安装 angular cli 时,它出错了.我希望这里有人能告诉我如何修复它,或以其他方式安装它.运行 npm install -g @angular/cli 的输出如下:

<预><代码>rxjs@6.3.3 的 npm WARN tarball tarball 数据(sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuh)似乎已损坏.==再试一次.打字稿@3.2.4 的 npm WARN tarball tarball 数据(sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg 似乎已损坏==)再试一次.npm 错误!路径 C:\Users\User\AppData\Roaming\npm\node_modules\.staging\typescript-4ae55f23\lib\fr\diagnosticMessages.generated.jsonnpm 错误!代码 EPERMnpm 错误!错误号 -4048npm 错误!系统调用取消链接npm 错误!错误:EPERM:不允许操作,取消链接C:\Users\User\AppData\Roaming\npm\node_modules\.staging\typescript-4ae55f23\lib\fr\diagnosticMessages.generated.json"npm 错误!{ [错误:EPERM:不允许操作,取消链接'C:\Users\User\AppData\Roaming\npm\node_modules\.staging\typescript-4ae55f23\lib\fr\diagnosticMessages.generated.json']npm 错误!原因:npm 错误!{ 错误:EPERM:操作不允许,取消链接 'C:\Users\User\AppData\Roaming\npm\node_modules\.staging\typescript-4ae55f23\lib\fr\diagnosticMessages.generated.json'npm 错误!错误号:-4048,npm 错误!代码:'EPERM',npm 错误!系统调用:'取消链接',npm 错误!小路:npm 错误!'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\.staging\\typescript-4ae55f23\\lib\\fr\\diagnosticMessages.generated.json' },npm 错误!堆:npm 错误!'错误:EPERM:不允许操作,取消链接 \'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\.staging\\typescript-4ae55f23\\lib\\fr\\diagnosticMessages.generated.json\'',npm 错误!错误号:-4048,npm 错误!代码:'EPERM',npm 错误!系统调用:'取消链接',npm 错误!小路:npm 错误!'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\.staging\\typescript-4ae55f23\\lib\\fr\\diagnosticMessages.generated.json',npm 错误!父级:'@angular/cli' }npm 错误!npm 错误!您的操作系统拒绝了该操作.npm 错误!该文件可能已在使用中(通过文本编辑器或防病毒软件),npm 错误!或者您缺乏访问它的权限.npm 错误!npm 错误!如果您认为这可能是权限问题,请仔细检查npm 错误!文件及其包含目录的权限,或尝试运行npm 错误!再次以 root/管理员身份执行命令(尽管不推荐这样做).npm 错误!可以在以下位置找到此运行的完整日志:npm 错误!C:\Users\User\AppData\Roaming\npm-cache\_logs\2019-02-11T19_33_51_436Z-debug.log

我不确定是什么导致了这个问题,或者如何解决它.任何帮助将不胜感激.

节点版本为:10.15.1

NPM 版本为:6.7.0

解决方案

我在 github 上找到了这个关于 angular cli 的问题页面的解决方案

npm install -global typescript@3.1.6

(注意安装的是3.1.6版本,你可以安装你选择的更高版本)

重新运行命令:

npm install -global @angular/cli

以上解决了错误:WARN tarball tarball data for typescript@3.1.6 (sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hQXXwDlqb) 似乎已损坏

YJbXY5h

when I try to install the angular cli through npm, it errors out. I was hoping someone here might be able to tell me how to fix it, or install it another way. The output from running npm install -g @angular/cli is as follows:


npm WARN tarball tarball data for rxjs@6.3.3 (sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for typescript@3.2.4 (sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg==) seems to be corrupted. Trying one more time.
npm ERR! path C:\Users\User\AppData\Roaming\npm\node_modules\.staging\typescript-4ae55f23\lib\fr\diagnosticMessages.generated.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\User\AppData\Roaming\npm\node_modules\.staging\typescript-4ae55f23\lib\fr\diagnosticMessages.generated.json'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'C:\Users\User\AppData\Roaming\npm\node_modules\.staging\typescript-4ae55f23\lib\fr\diagnosticMessages.generated.json']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'C:\Users\User\AppData\Roaming\npm\node_modules\.staging\typescript-4ae55f23\lib\fr\diagnosticMessages.generated.json'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\.staging\\typescript-4ae55f23\\lib\\fr\\diagnosticMessages.generated.json' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\.staging\\typescript-4ae55f23\\lib\\fr\\diagnosticMessages.generated.json\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\.staging\\typescript-4ae55f23\\lib\\fr\\diagnosticMessages.generated.json',
npm ERR!   parent: '@angular/cli' }
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\User\AppData\Roaming\npm-cache\_logs\2019-02-11T19_33_51_436Z-debug.log

I'm unsure of what is causing the issue, or how to go about fixing it. Any help would be greatly appreciated.

Node version is: 10.15.1

NPM version is: 6.7.0

解决方案

I found this solution on github about angular cli's issues page

npm install -global typescript@3.1.6

(Mind you that installs version 3.1.6, you can install an upper version of your choice)

Rerun command:

npm install -global @angular/cli

The above solve the error: WARN tarball tarball data for typescript@3.1.6 (sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==) seems to be corrupted.

这篇关于无法安装 angular-cli:EPERM -4048 unlink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆