无法读取未定义的属性“NullLogger"(angular/cli 1.4.7) [英] Can not read property 'NullLogger' of undefined (angular/cli 1.4.7)

查看:20
本文介绍了无法读取未定义的属性“NullLogger"(angular/cli 1.4.7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我突然开始收到这个错误尝试在我的 angular 4 应用程序中添加组件 (ng g c abc) 时,无法读取未定义的属性 'NullLogger'".当我在 google 上搜索时,人们建议我们需要将 cli 版本更新到 1.4.10 .但问题是为什么我们现在为 1.4.10 以下的所有 angular/cli 版本收到此错误?.我现在不想更新我的 CLI 版本.有谁知道为什么会这样??

Today, sudeenly I start getting this error "Cannot read property 'NullLogger' of undefined" while trying to add a component ( ng g c abc) in my angular 4 app. When I searched it on google, people are suggesting that we need to update our cli version to 1.4.10 . But the question is why we are getting this error now for all angular/cli version below 1.4.10? . I do not want to update my CLI version now. Does anyone know why is it happening??

以下是我的 package.json 文件,

Following is my package.json file,

依赖关系":{"@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-b​​rowser": "^4.4.6","@angular/platform-b​​rowser-dynamic": "^4.4.6","@angular/router": "^4.4.6","angular2-csv": "^0.2.5","引导程序": "^3.3.7","classlist.js": "^1.1.20150312","core-js": "^2.4.1","font-awesome": "^4.7.0","jquery": "^3.2.1","lodash": "^4.17.4","ng-select": "^1.0.0-rc.3","ng2-dragula": "^1.5.0",反射元数据":^0.1.10","rxjs": "^5.4.2","toastr": "^2.1.2","下划线": "^1.8.3","web-animations-js": "^2.3.1",zone.js":^0.8.14"},开发依赖":{"@angular/cli": "1.4.7","@angular/compiler-cli": "^4.4.6","@angular/language-service": "^4.4.6","@types/jasmine": "~2.5.53","@types/jasminewd2": "~2.0.2","@types/node": "~6.0.60","@types/toastr": "^2.1.35","codelyzer": "~3.2.0","jasmine-core": "~2.6.2","jasmine-spec-reporter": "~4.1.0","karma": "~1.7.0","karma-chrome-launcher": "~2.1.1","karma-cli": "~1.0.1","karma-coverage-istanbul-reporter": "^1.2.1","karma-jasmine": "~1.1.0","karma-jasmine-html-reporter": "^0.2.2",量角器":~5.1.2","ts-node": "~3.2.0","tslint": "~5.7.0",打字稿":^2.3.4"}

推荐答案

我做了以下来解决问题,

I did following to resolve the issue,

全局卸载@angular/cli

Uninstall @angular/cli globally

npm uninstall -g @angular/cli

本地卸载@angular/cli

Uninstall @angular/cli locally

npm uninstall --save-dev @angular/cli

清除缓存,

npm 缓存清理

再次全局和本地安装@angular/cli

install @angular/cli globally and locally again

npm install -g @angular/cli@latest

npm install --save-dev @angular/cli@latest

之后一切正常.

这篇关于无法读取未定义的属性“NullLogger"(angular/cli 1.4.7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆