首页 > 解决方案 > 以角度创建新项目时出错

问题描述

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

我收到以下错误消息,

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).

标签: node.jsangularnpm

解决方案


临时修复,将 npm 降级到 5.3

npm install npm@5.3 -g

推荐阅读