cli 命令 ng new 不适用于 angular 7 [英] cli command ng new not working for angular 7

查看:25
本文介绍了cli 命令 ng new 不适用于 angular 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚将我的 cli、npm、ng 和 nodejs 更新到最新版本.ng v 给出了这个:

Just updated my cli, npm, ng and nodejs to latest versions. An ng v gives this:

Angular CLI: 7.0.2
Node: 8.12.0
OS: darwin x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.10.2
@angular-devkit/core         7.0.2
@angular-devkit/schematics   7.0.2
@schematics/angular          7.0.2
@schematics/update           0.10.2
rxjs                         6.3.3
typescript                   3.1.3

也成功更新旧的 Angular 6 项目.但是,在发出命令 ng new myproj 后,我得到了结果:

Update old Angular 6 projects successfully also. However, upon issuing the command ng new myproj, I get the result:

Schematic input does not validate against the Schema: {"name":"myproj"}
Errors:

  Data path "" should have required property 'version'.

这个问题很新鲜,网上没有解决方法.有什么帮助吗?

The issue is so fresh there isn't how-to-fix online. Any help?

推荐答案

我也遇到过类似的问题.我严格尝试了以下步骤:

I have had similar sort of issue.I tried the following steps strictly:

Uninstall angular cli(npm uninstall -g @angular/cli)

Uninstall node.js from control panel/add or remove software option of your computer

-> 从计算机手动删除 npm 和 npm-cache 文件夹(这些文件夹在 C:\Users\asus\AppData\Roaming 中,就您而言用户"可能是您的姓名,华硕"可能是您的计算机制造商名称)

->Delete npm and npm-cache folder manually from computer(These folders are in C:\Users\asus\AppData\Roaming,in your case 'Users' maybe your name and 'asus' maybe your computer manufacturers name)

->重新安装最新的node.js版本(安装时选择npm as package manager"选项)

->Re-install latest node.js version(select the option "npm as package manager" wile installing)

Run the command "npm i -g npm@latest" at powershell/gitbash

->重启电脑

Run "npm install -g @angular/cli" command

Run "ng config -g cli.packageManager npm" command

Run "npm cache verify" command(or npm cache clean --force if node version < 5)

一切正常.

这篇关于cli 命令 ng new 不适用于 angular 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆