【问题标题】:angular-cli was not updated and ng serve does not workangular-cli 未更新,ng serve 不起作用
【发布时间】:2020-10-07 07:29:58
【问题描述】:

我想更新我的 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缓存,不过没关系。

【问题讨论】:

    标签: angular npm angular-cli npm-install


    【解决方案1】:

    你有任何 Angular 应用程序正在运行吗?尝试重新启动系统并再次运行命令。 这些文件可能被正在运行的应用程序锁定,从而导致上述错误。

    【讨论】:

      猜你喜欢
      • 2017-04-12
      • 1970-01-01
      • 2019-11-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-07
      • 2020-04-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多