简体   繁体   English

在angular中创建新项目时出错

[英]Error while creating new project in angular

I am trying to create new angular project using the command ng new my-app . 我正在尝试使用ng new my-app命令创建新的角度项目。 And the installed versions are listed below 并在下面列出了已安装的版本

  • Angular CLI : 6.0 角CLI:6.0
  • Node version : 10.5.0 节点版本:10.5.0
  • Npm : 6.1.0 Npm:6.1.0

I am getting the following error message, 我收到以下错误消息,

ERR! path D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts']
npm ERR!   cause:
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!   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).

Use administrator privileges. 使用管理员权限。 Error says you are not using admin CMD 错误提示您未使用管理员CMD

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

临时修复,将npm降级到5.3

npm install npm@5.3 -g

Are you using Node Cmd or any IDE(like VSCode) to create new project 您是否正在使用Node Cmd或任何IDE(例如VSCode)创建新项目

try this command 试试这个命令

  1. npm i -g @angular/cli npm我-g @ angular / cli
  2. ng new app-name ng新的应用名称
  3. cd app-name. cd应用程序名称。
  4. ng serve ng服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM