我有角度2项目,更新@ angular / cli后,webpack和打字稿版本我得到这个错误,令人困惑的一面是我只在这个角度2项目中得到错误,另一个工作得非常好。我在下面分享错误和package.json。我已在全球和本地更新了角度cli。版本有问题吗?
\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:329
if(_this.profile) {
^
TypeError: Cannot read property 'profile' of null
的package.json
{
"name": "crm-ca",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"angular2-cookie": "^1.2.5",
"angular2-text-mask": "^2.1.0",
"bootstrap": "^4.0.0-alpha.3",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/cli": "^1.0.0",
"@angular/compiler-cli": "^2.3.1",
"@types/bootstrap": "^3.3.32",
"@types/jasmine": "2.5.38",
"@types/jquery": "^2.0.40",
"@types/node": "^6.0.42",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "~4.0.13",
"ts-node": "1.2.1",
"tslint": "^4.0.2",
"typescript": "^2.2.2",
"webpack": "^2.2.0",
"webpack-dev-server": "^2.1.0-beta.9"
}
}
答案 0 :(得分:2)
我建议您从webpack
删除webpack-dev-server
和package.json
。 angular-cli
使用自己的webpack
版本,该版本与package.json
中的内容发生冲突。我有这个问题,这是对我有用的解决方案。
答案 1 :(得分:0)
我找到了以下here,它对我有用:
npm uninstall --save-dev webpack
sudo rm -R node_modules
npm install
答案 2 :(得分:0)
嘿,从您的 webpack
中删除 webpack-dev-server
和 package.json
并运行 npm uninstall --save-dev webpack
这应该可以处理您的情况。