angular - 初始化我的 Angular 6 项目失败:原理图不起作用
问题描述
我正在尝试创建一个新的角度项目并添加@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
为了创建我的项目并从头开始添加材料原理图,我执行了以下命令:
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
角.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`
....
},
...
}
}
推荐阅读
- r - 通过 geom_smooth 添加回归线,在一张图中有和没有颜色分组
- ruby-on-rails - 使用 Sidekiq 的 RSpec 邮件测试发送空 [] 错误
- java - 如何将 SearchView 查询添加到 FirestoreRecyclerOptions?
- path - 在域路径上使用 Google ReCaptcha
- php - 基于 WooCommerce 中订单总额的运费折扣百分比
- c# - 在具有内存限制的 Docker 容器中运行 .NET Core 应用程序
- flask - Heroku CLI 看不到 Flask 应用程序的静态文件
- r - 具有多列的非参数方差分析
- c++ - ChangeDisplaySettingsEx 更改屏幕顺序
- angular - 如何自动将扩展面板内容中的编辑器聚焦到以角度打开扩展面板?