Angular-cli: Not able to create a module with lazy loading.

Created on 19 Jan 2018  Â·  9Comments  Â·  Source: angular/angular-cli

Versions

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.4.9
node: 6.11.2
os: darwin x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.9
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
typescript: 2.3.4

Repro steps

  • Create a new app - ng new customer-app --routing
  • Try to create a new module via CLI - ng generate module customers --routing

Observed behavior

TypeError: Cannot read property 'NullLogger' of undefined
    at SchematicEngine.createContext (/Applications/XAMPP/xamppfiles/htdocs/customer-app/node_modules/@angular-devkit/schematics/src/engine/engine.js:64:38)
    at SchematicImpl.call (/Applications/XAMPP/xamppfiles/htdocs/customer-app/node_modules/@angular-devkit/schematics/src/engine/schematic.js:35:38)
    at Promise (/Applications/XAMPP/xamppfiles/htdocs/customer-app/node_modules/@angular/cli/tasks/schematic-run.js:72:23)
    at Class.run (/Applications/XAMPP/xamppfiles/htdocs/customer-app/node_modules/@angular/cli/tasks/schematic-run.js:71:16)
    at Class.run (/Applications/XAMPP/xamppfiles/htdocs/customer-app/node_modules/@angular/cli/commands/generate.js:149:33)
    at resolve (/Applications/XAMPP/xamppfiles/htdocs/customer-app/node_modules/@angular/cli/ember-cli/lib/models/command.js:261:20)
    at Class.validateAndRun (/Applications/XAMPP/xamppfiles/htdocs/customer-app/node_modules/@angular/cli/ember-cli/lib/models/command.js:240:12)
    at Promise.resolve.then.then (/Applications/XAMPP/xamppfiles/htdocs/customer-app/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:140:24)

Desired behavior

Create a module with routes of itself within it.

Is this only in Angular 1.5+?

Most helpful comment

install angular-cli with g after clearing cache
sudo npm cache clean --force
sudo npm install -g @angular/cli@latest
it worked for me

All 9 comments

me too not able to create

install angular-cli with g after clearing cache
sudo npm cache clean --force
sudo npm install -g @angular/cli@latest
it worked for me

@sravaniperumalla that will get you latest cli, I want to work in Angular version 4 not version 5.

+1

@abhishekdgeek - the CLI update worked for me and it just updated the CLI version and not the other core angular modules.

Still not sure why it stopped to work in previous version all of a sudden.

Yes! @yogZ-codeR my problem was resolved the very same day with 1.4.10 I am just curious how this is happening as I have used 1.4.9 for all my projects!

Fixed by a release of CLI 1.4.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings