在角度中创建新项目时出错



我正在尝试使用命令创建新的角度项目ng new my-app.下面列出了已安装的版本

  • 角度命令行界面 : 6.0
  • 节点版本 : 10.5.0
  • 每分钟: 6.1.0

我收到以下错误消息,

ERR! path D:ngnewappnode_modules.stagingtypescript-4c0ca0e6liblib.dom.d.ts
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:ngnewappnode_modules.stagingtypescript-4c0ca0e6liblib.dom.d.ts'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'D:ngnewappnode_modules.stagingtypescript-4c0ca0e6liblib.dom.d.ts']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'D:ngnewappnode_modules.stagingtypescript-4c0ca0e6liblib.dom.d.ts'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink 'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts',
npm ERR!   parent: '@angular-devkit/build-optimizer' }
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 降级到 5.3

npm install npm@5.3 -g

使用管理员权限。错误说您没有使用管理员 CMD

  • 关闭代码编辑器后安装包,

您是否正在使用Node Cmd或任何IDE(如VSCode)来创建新项目

试试这个命令

  1. npm i -g @angular/CLI
  2. 吴新应用名称
  3. 光盘应用名称。
  4. 吴氏服务

最新更新