我该如何解决此安装问题

时间:2019-07-03 04:33:48

标签: angular installation angular-cli

我正在Windows 7系统上安装Angular新项目, 我在安装时遇到问题 有什么办法解决这个问题吗?

我创建了一个新的角度项目 它给出了错误 我也尝试在旧项目中安装npm,但无法再次使用 ,我也尝试再次安装打字稿,我也尝试删除package-lock.json并再次安装npm,然后我尝试了ng v

当ng v得到这个

Angular CLI: 8.0.3
Node: 10.16.0
OS: win32 ia32
Angular: <error>
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.800.3 (cli-only)
@angular-devkit/build-angular   <error>
@angular-devkit/core            8.0.3 (cli-only)
@angular-devkit/schematics      8.0.3 (cli-only)
@schematics/angular             8.0.3 (cli-only)
@schematics/update              0.800.3 (cli-only)
rxjs                            6.4.0 (cli-only)
typescript                      <error>

我希望运行该程序 创建新的角度项目时会收到​​此错误消息

npm ERR! path D:\AngularProject\myNew\node_modules\.staging\@yarnpkg\lockfile-31897f94\index.js
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\AngularProject\myNew\node_modules\.staging\@yarnpkg\lockfile-31897f94\index.js'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'D:\AngularProject\myNew\node_modules\.staging\@yarnpkg\lockfile-31897f94\index.js']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'D:\AngularProject\myNew\node_modules\.staging\@yarnpkg\lockfile-31897f94\index.js'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'D:\\AngularProject\\myNew\\node_modules\\.staging\\@yarnpkg\\lockfile-31897f94\\index.js' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'D:\\AngularProject\\myNew\\node_modules\\.staging\\@yarnpkg\\lockfile-31897f94\\index.js\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'D:\\AngularProject\\myNew\\node_modules\\.staging\\@yarnpkg\\lockfile-31897f94\\index.js',
npm ERR!   parent: 'myNew' }
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).

有什么办法解决这个问题?

2 个答案:

答案 0 :(得分:0)

这似乎是您的 node / npm 的问题,而不是 Angular CLI 的问题。

第1步:以管理员身份卸载angular / cli和nodejs。

第2步:从%appdata%(npm,npm-cache)中删除文件夹,或使用以下命令npm cache clean

第3步:从程序和文件中删除“ nodejs”文件夹

第4步:重新启动

第5步重新启用最新版本的节点

Setp 6:安装angular / cli

答案 1 :(得分:0)

当我尝试创建新的Angular项目时遇到了类似的问题。 我不知道您是否已经解决了您的问题,但是对于那些仍然遇到相同问题的人, 这个答案对我有用https://stackoverflow.com/a/52853169/ 希望它也对您有用。