初始化我的 Angular 6 项目失败:原理图不起作用
Init my Angular 6 project fails : schematics does not works
我正在尝试创建一个新的 angular 项目并添加 @angular/material
原理图。但它失败并出现此错误:
Installed packages for tooling via npm.
Your project is not using the default configuration for build and test. The Angular Material schematics can only be used with the default configuration
为了创建我的项目并从头开始添加 material 原理图,我执行了以下命令:
nvm use v10.10.0
npm install -g @angular/cli # Version is : @angular/cli@6.2.1
npm install -g @angular-devkit/schematics-cli # Version is : @angular-devkit/schematics-cli@0.8.1
ng new a
cd a
ng add @angular/material # -> Error here
有什么想法吗?谢谢!
此问题已在 github 中记录,您可以使用 #12230.
关注相同问题
但到那时它已经解决了,你可以使用下面的解决方法你必须稍微调整一下angular.json
改变
projects.YOUR-APP-NAME.targets
到
projects.YOUR-APP-NAME.architect
找到下面的解释,看看在 angular.json
中需要进行哪些更改
angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"sample-bank": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"targets": { //< -- change `targets` to `architect`
....
},
...
}
}
我正在尝试创建一个新的 angular 项目并添加 @angular/material
原理图。但它失败并出现此错误:
Installed packages for tooling via npm.
Your project is not using the default configuration for build and test. The Angular Material schematics can only be used with the default configuration
为了创建我的项目并从头开始添加 material 原理图,我执行了以下命令:
nvm use v10.10.0
npm install -g @angular/cli # Version is : @angular/cli@6.2.1
npm install -g @angular-devkit/schematics-cli # Version is : @angular-devkit/schematics-cli@0.8.1
ng new a
cd a
ng add @angular/material # -> Error here
有什么想法吗?谢谢!
此问题已在 github 中记录,您可以使用 #12230.
关注相同问题但到那时它已经解决了,你可以使用下面的解决方法你必须稍微调整一下angular.json
改变
projects.YOUR-APP-NAME.targets
到
projects.YOUR-APP-NAME.architect
找到下面的解释,看看在 angular.json
angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"sample-bank": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"targets": { //< -- change `targets` to `architect`
....
},
...
}
}