Angular-cli: Angular 1.4.9 : Cannot read property 'NullLogger' of undefined

Created on 20 Jan 2018  路  19Comments  路  Source: angular/angular-cli

Angular/cli 4 - 1.4.9

Output from: ng --version.
@angular/cli: 1.4.9
node: 8.9.4
os: win32 x64
Windows 10 - ver 1709(16299)

Repro steps

C:\Users\Owner\AppData\Roamingnpm\ng -> C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\cli\bin\ng

[email protected] postinstall C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\clinode_modules\uglifyjs-webpack-plugin
node lib/post_install.js

npm WARN @angular-devkit/[email protected] requires a peer of @angular-devkit/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @schematics/[email protected] requires a peer of @angular-devkit/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\@angular\clinode_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

  • @angular/[email protected]
    added 59 packages, removed 351 packages, updated 29 packages and moved 10 packages in 80.908s

  • Step 2
    $ ng new ang4test

Cannot read property 'NullLogger' of undefined
TypeError: Cannot read property 'NullLogger' of undefined
at SchematicEngine.createContext (C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\clinode_modules\@angular-devkit\schematics\src\engine\engine.js:64:39)
at SchematicImpl.call (C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\clinode_modules\@angular-devkit\schematics\src\engine\schematic.js:35:38)
at Promise (C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\cli\tasks\schematic-run.js:72:23)
at new Promise ()
at Class.run (C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\cli\tasks\schematic-run.js:71:16)
at Class.run (C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\cli\tasks\init.js:71:33)
at Class.run (C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\cli\commands\new.js:133:25)
at resolve (C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\cli\ember-cli\lib\models\command.js:261:20)
at new Promise ()
at Class.validateAndRun (C:\Users\Owner\AppData\Roamingnpmnode_modules\@angular\cli\ember-cli\lib\models\command.js:240:12)

  • Step 3

Observed behavior

All outputs shown above

Desired behavior

I expected new project to be made.

Mention any other details that might be useful (optional)

I've tried to install before many times. Installed and uninstalled, cleaned cache, but failed.

Most helpful comment

I also faced the same issue but resolved by following this steps they will help you.

npm uninstall -g @angular/cli
npm uninstall --save-dev @angular/cli
npm cache clean
npm install -g @angular/cli@latest
npm install --save-dev @angular/cli@latest

it worked for me.

All 19 comments

Can you try with 1.4.10?

Thank you for your reply. I cleaned cache by force and installed 1.4.10.
Installed successfully and had no errors. Issue resolved.

I just followed to suggestion and installed version 1.4.10
Please first uninstall all versions and clear the cache, and after install:
ng install -g @angular/[email protected]

Just a question: why is this error occurring in cli versions older then 1.4.10?

Also seeing this issue:

ng g component MyComponent
Your global Angular CLI version (1.6.5) is greater than your local
version (1.4.1). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
Cannot read property 'NullLogger' of undefined
TypeError: Cannot read property 'NullLogger' of undefined
at SchematicEngine.createContext (/home/alan/NetBeansProjects/ums-gui-trunk/ums-gui-webapp/src/main/angular/node_modules/@angular-devkit/schematics/src/engine/engine.js:64:38)
at SchematicImpl.call (/home/alan/NetBeansProjects/ums-gui-trunk/ums-gui-webapp/src/main/angular/node_modules/@angular-devkit/schematics/src/engine/schematic.js:35:38)
at Promise (/home/alan/NetBeansProjects/ums-gui-trunk/ums-gui-webapp/src/main/angular/node_modules/@angular/cli/tasks/schematic-run.js:77:23)
at Class.run (/home/alan/NetBeansProjects/ums-gui-trunk/ums-gui-webapp/src/main/angular/node_modules/@angular/cli/tasks/schematic-run.js:76:16)
at Class.run (/home/alan/NetBeansProjects/ums-gui-trunk/ums-gui-webapp/src/main/angular/node_modules/@angular/cli/commands/generate.js:138:33)
at resolve (/home/alan/NetBeansProjects/ums-gui-trunk/ums-gui-webapp/src/main/angular/node_modules/@angular/cli/ember-cli/lib/models/command.js:273:20)
at Class.validateAndRun (/home/alan/NetBeansProjects/ums-gui-trunk/ums-gui-webapp/src/main/angular/node_modules/@angular/cli/ember-cli/lib/models/command.js:251:12)
at Promise.resolve.then.then (/home/alan/NetBeansProjects/ums-gui-trunk/ums-gui-webapp/src/main/angular/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:154:24)
at process._tickCallback (internal/process/next_tick.js:109:7)

I m getting the same error tried to update the angular cli to latest one but still getting the same

definitely angular sucks... sorry for posting this... but this can't happen in two platforms today in 2018...

Had the same issue today. Upgraded to angular-cli 1.7.0 both globally and for the project and the issue is fixed.

Wow I guess It wasn't just happening to me.

The same error had happened to me, when
@angular/cli: 1.4.8
node: 8.10.0

After upgrading the angular CLI, ng new newappworked fine.

@angular/cli: 1.7.3
node:8.10.0

I also faced the same issue but resolved by following this steps they will help you.

npm uninstall -g @angular/cli
npm uninstall --save-dev @angular/cli
npm cache clean
npm install -g @angular/cli@latest
npm install --save-dev @angular/cli@latest

it worked for me.

@srinivas444 these steps worked for me . thanks

@ulans2017
its=> npm install -g @angular/[email protected]
Not => ng install -g @angular/[email protected]

@srinivas444 worked for me, but only with 1.4.10 version.

I also faced the same issue but resolved by following this steps they will help you.

npm uninstall -g @angular/cli
npm uninstall --save-dev @angular/cli
npm cache clean
npm install -g @angular/cli@latest
npm install --save-dev @angular/cli@latest

it worked for me.

if npm cache clean gives you error then use --force flag as follows.

Here is the code to clean the cache forcefully.

npm cache clean --force

Why are broken versions listed as available to install? This would save developers a lot of time if they were not or at least listed as broken.

Surprised to have run into this issue. Just following the tutorial on Angular.IO and run into this first off the bat. Trying AliShan's steps right now. First uninstall took 1000 seconds.

It worked however, I had to create another project, the original project got messed up somehow with those steps, I got a message that it did not exist. When I created the new project, I was asked two questions one was if I wanted to use CSS, haven't seen that before. I can now generate a component,

I also faced the same issue but resolved by following these steps they will help you.

npm uninstall -g @angular/cli
npm uninstall --save-dev @angular/cli
npm cache clean
npm install -g @angular/cli@latest
npm install --save-dev @angular/cli@latest

it worked for me.

I just followed to suggestion and installed version 1.4.10
Please first uninstall all versions and clear the cache, and after install:
ng install -g @angular/[email protected]

The last command should be npm install -g @angular/[email protected] right? because ng command didn't seem to work

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

Related issues

rajjejosefsson picture rajjejosefsson  路  3Comments

hartjo picture hartjo  路  3Comments

NCC1701M picture NCC1701M  路  3Comments

ericel picture ericel  路  3Comments

sysmat picture sysmat  路  3Comments