angular-cli未更新,并且ng服务无法正常工作

时间:2020-10-07 07:29:58

标签: angular npm angular-cli npm-install

我想更新我的angular-cli。我正在使用:

npm install -g @angular/cli

但是我收到此控制台错误:

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! path C:\Users\Saeed\AppData\Roaming\npm\ng
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall open
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\Saeed\AppData\Roaming\npm\ng'
npm ERR!  { [Error: EPERM: operation not permitted, open 'C:\Users\Saeed\AppData\Roaming\npm\ng']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, open 'C:\Users\Saeed\AppData\Roaming\npm\ng'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'open',
npm ERR!      path: 'C:\\Users\\Saeed\\AppData\\Roaming\\npm\\ng' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, open \'C:\\Users\\Saeed\\AppData\\Roaming\\npm\\ng\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'C:\\Users\\Saeed\\AppData\\Roaming\\npm\\ng' }
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\Saeed\AppData\Roaming\npm-cache\_logs\2020-10-07T07_21_17_386Z-debug.log

,然后当我想运行ng serve时,出现以下错误:

bash: /c/Users/Saeed/AppData/Roaming/npm/ng: Permission denied

我该怎么办?有帮助吗?

我还删除了npm缓存,但这没关系。

1 个答案:

答案 0 :(得分:0)

您是否正在运行任何角度应用程序?尝试重新启动系统,然后再次运行命令。 这些文件可能已被正在运行的应用锁定,从而导致您在上面看到错误。