无法安装角度 cli:EPERM -4048 取消链接



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


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:UsersUserAppDataRoamingnpmnode_modules.stagingtypescript-4ae55f23libfrdiagnosticMessages.generated.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:UsersUserAppDataRoamingnpmnode_modules.stagingtypescript-4ae55f23libfrdiagnosticMessages.generated.json'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'C:UsersUserAppDataRoamingnpmnode_modules.stagingtypescript-4ae55f23libfrdiagnosticMessages.generated.json']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'C:UsersUserAppDataRoamingnpmnode_modules.stagingtypescript-4ae55f23libfrdiagnosticMessages.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:UsersUserAppDataRoamingnpm-cache_logs2019-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 压缩包 typescript@3.1.6 的压缩包数据 (sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==( 似乎已损坏

不了解 Linux 用户,但在 Windows 上,这救了我的命。在c:/users/your user name/roaming/appdata/npm找到 npm 文件夹并对同一位置的 npm 缓存执行相同的操作右键单击它并取消选中只读复选框,然后单击应用,即使 npm 没有直接说出来,我发现这是一个权限问题,这对我来说非常有效

最新更新