angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Angular 1.4.9 : Cannot read property 'NullLogger' of undefined

Open ulantiger opened this issue 8 years ago • 19 comments

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\Roaming\npm\ng -> C:\Users\Owner\AppData\Roaming\npm\node_modules@angular\cli\bin\ng

[email protected] postinstall C:\Users\Owner\AppData\Roaming\npm\node_modules@angular\cli\node_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\cli\node_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\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\src\engine\engine.js:64:39) at SchematicImpl.call (C:\Users\Owner\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\src\engine\schematic.js:35:38) at Promise (C:\Users\Owner\AppData\Roaming\npm\node_modules@angular\cli\tasks\schematic-run.js:72:23) at new Promise () at Class.run (C:\Users\Owner\AppData\Roaming\npm\node_modules@angular\cli\tasks\schematic-run.js:71:16) at Class.run (C:\Users\Owner\AppData\Roaming\npm\node_modules@angular\cli\tasks\init.js:71:33) at Class.run (C:\Users\Owner\AppData\Roaming\npm\node_modules@angular\cli\commands\new.js:133:25) at resolve (C:\Users\Owner\AppData\Roaming\npm\node_modules@angular\cli\ember-cli\lib\models\command.js:261:20) at new Promise () at Class.validateAndRun (C:\Users\Owner\AppData\Roaming\npm\node_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.

ulantiger avatar Jan 20 '18 15:01 ulantiger

Can you try with 1.4.10?

clydin avatar Jan 20 '18 15:01 clydin

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

ulantiger avatar Jan 20 '18 15:01 ulantiger

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]

ulantiger avatar Jan 21 '18 14:01 ulantiger

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

ghost avatar Jan 23 '18 14:01 ghost

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)

asmith2306 avatar Jan 24 '18 15:01 asmith2306

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

gurpreetcigs avatar Jan 27 '18 18:01 gurpreetcigs

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

albertotorresfoltyn avatar Jan 31 '18 17:01 albertotorresfoltyn

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

mpituley avatar Feb 16 '18 21:02 mpituley

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

ProgrammingFuad avatar Feb 20 '18 05:02 ProgrammingFuad

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

After upgrading the angular CLI, ng new newapp worked fine.

@angular/cli: 1.7.3 node:8.10.0

hazeeb avatar Mar 10 '18 11:03 hazeeb

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 avatar Mar 29 '18 06:03 srinivas444

@srinivas444 these steps worked for me . thanks

HARSINH2DEC avatar Apr 11 '18 07:04 HARSINH2DEC

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

noor07 avatar Apr 19 '18 05:04 noor07

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

gustavomts avatar Aug 21 '18 03:08 gustavomts

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

alishannb avatar Nov 23 '18 10:11 alishannb

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.

rbrisita avatar Apr 17 '19 00:04 rbrisita

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,

jkosanovic avatar Apr 24 '19 16:04 jkosanovic

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

MenukaIshan avatar May 23 '19 10:05 MenukaIshan

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.