jeremieca
jeremieca

Reputation: 1188

Init my Angular 6 project fails : schematics does not works

I'm trying to create a new angular project and add the @angular/material schematics. But it fails with this error :

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

To create my project and add the material schematics from scratch I done the following commands :

nvm use v10.10.0
npm install -g @angular/cli # Version is : @angular/[email protected]
npm install -g @angular-devkit/schematics-cli # Version is : @angular-devkit/[email protected]
ng new a
cd a
ng add @angular/material # -> Error here

Any ideas ? Thanks !

Upvotes: 1

Views: 568

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136144

This issue is already logged in github, you can keep eye on the same using #12230.

But till then it is resolved, you can use below work around you have to tweak angular.json a bit

Change

projects.YOUR-APP-NAME.targets

To

projects.YOUR-APP-NAME.architect

Find below explanation to see where exactly change needs to be made in 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`
        ....
      },
      ...
  }
}

Upvotes: 1

Related Questions