Ng add ng-alain encountered an error: Cannot read property 'build' of undefined

follow the steps to start using the document and cannot continue if you encounter an error

use ng add ng-alain to add modules, and proceed to further study if you encounter errors. Complete output information:

Angular CLI: 6.2.1
Node: 8.11.2
OS: win32 x64
Angular: 6.1.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.1
@angular-devkit/build-angular     0.8.1
@angular-devkit/build-optimizer   0.8.1
@angular-devkit/build-webpack     0.8.1
@angular-devkit/core              0.8.1
@angular-devkit/schematics        0.8.1
@angular/cli                      6.2.1
@ngtools/webpack                  6.2.1
@schematics/angular               0.8.1
@schematics/update                0.8.1
rxjs                              6.2.2
typescript                        2.9.2
webpack                           4.17.2

I use it for the first time, but I don"t know how to deal with it. I also ask the students to help me. Thank you very much.

Jun.04,2021

Welcome to the open source community! In this community, there will be all kinds of mismatches, sometimes we need to wait for the bosses to send a new version to match each other, and sometimes they are impatient and play monsters in person, and it is also a way to open pull request to help the bosses get rid of demons.

the reason for your problem is that the Angular version is too advanced, while the ng-alain version has not yet caught up. Pay attention to the error message:

npm WARN ng-alain@1.4.0 requires a peer of @angular-devkit/core@^0.6.1

ng-alian says it requires @ angular-devkit/core@ ^ 0.6.1 , and the version you provide is:

@angular-devkit/core              0.8.1

so there are 3 methods at present:

  1. wait ng-alain the new version supports 0.8.1 . 4 hours ago ng-alain just released version 1.4.2 , check out its package.json file, you will find that they are just beginning to support 0.8.0 . The version of Angular it supports is only 6.1.0 , while the version of Angular you installed is 6.1.7 , so it still doesn't match. Or you can download their source code, convert it to support Angular 6.1.7 and upload it to see if they are willing to accept it.
  2. modify your package.json file, change all the places that say 6.1.7 to 6.1.0 or lower, and then re- npm install .
  3. does not manually modify package.json , but reinstalls earlier version of angular cli , and then regenerates the project:
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@6.1.0
  • ThemesService Services in ng-alain

    1. Has the ThemesService service been removed from the new version? 2. How to realize the skin-changing function in the new version? The old version was implemented with a build (header-theme, relies on ThemesService). ...

    May.27,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b5db-2bab9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b5db-2bab9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?