角度5.1升级后的Webpack错误,但package.json
中没有webpack这是我的Package.json
"dependencies": {
"@angular-devkit/schematics": "0.0.40",
"@angular/animations": "^5.1.0",
"@angular/common": "^5.1.0",
"@angular/compiler": "^5.1.0",
"@angular/core": "^5.1.0",
"@angular/forms": "^5.1.0",
"@angular/http": "^5.1.0",
"@angular/platform-browser": "^5.1.0",
"@angular/platform-browser-dynamic": "^5.1.0",
"@angular/platform-server": "^5.1.0",
"@angular/router": "^5.1.0",
"@angular/service-worker": "^5.1.0",
"bootstrap": "3.3.7",
"breeze-bridge-angular": "4.0.1",
"breeze-client": "1.6.3",
"core-js": "2.4.1",
"font-awesome": "4.7.0",
"jquery": "3.1.1",
"ngx-bootstrap": "^2.0.0-beta.9",
"ngx-color-picker": "4.5.0",
"ngx-gallery": "2.3.0",
"primeng": "4.3.0",
"quill": "1.3.2",
"rxjs": "^5.5.2",
"screenfull": "3.0.2",
"toastr": "2.1.2",
"ts-helpers": "1.1.1",
"zone.js": "0.8.14"
},
"devDependencies": {
"@angular/cli": "^1.6.0",
"@angular/compiler-cli": "^5.1.0",
"@types/jasmine": "2.5.53",
"@types/node": "8.0.7",
"codelyzer": "2.0.0",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.4.1",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "0.2.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"protractor": "5.1.0",
"ts-node": "2.0.0",
"tslint": "4.4.2",
"typescript": "2.5.3"
}
所有安装都很好,没有任何错误......
运行ng服务后我的错误
@angular/compiler-cli@5.1.0 requires typescript@'>=2.4.2 <2.5.0' but 2.5.3
was found instead.
Using this version can result in undefined behaviour and difficult to debug
problems.
Please run the following command to install a compatible version of
TypeScript.
npm install typescript@'>=2.4.2 <2.5.0'
To disable this warning run "ng set warnings.typescriptMismatch=false".
** NG Live Development Server is listening on localhost:4200, open your
browser on http://localhost:4200/ **
Date: 2017-12-07T12:54:30.173Z
Hash: f4590b1acb9318fb9940
Time: 7003ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 2.93 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 1.21 MB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 854 kB [initial] [rendered]
ERROR in Error: No NgModule metadata found for 'AppModule'.
at NgModuleResolver.resolve (C:\Users\Mike\...\node_modules\@angular\compiler\bundles\compiler.umd.js:20249:23)
at CompileMetadataResolver.getNgModuleMetadata (C:\Users\Mike\...\node_modules\@angular\compiler\bundles\compiler.umd.js:15218:60)
at visitLazyRoute (C:\Users\Mike\...\@angular\compiler\bundles\compiler.umd.js:31063:104)
at AotCompiler.listLazyRoutes (C:\Users\Mike\Source\...\node_modules\@angular\compiler\bundles\compiler.umd.js:31031:20)
at AngularCompilerProgram.listLazyRoutes (C:\Users\Mike\Source\Repos\...\node_modules\@angular\compiler-cli\src\transformers\program.js:156:30)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (C:\Users\Mike\Source\Repos\...\node_modules\@angular\compiler-cli\src\ngtools_api.js:44:36)
at AngularCompilerPlugin._getLazyRoutesFromNgtools (C:\Users\Mike\Source\Repos\...\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:247:66)
at Promise.resolve.then.then (C:\Users\Mike\Source\Repos\...\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:561:50)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
webpack: Failed to compile.
Terminate batch job (Y/N)? y
不确定为什么webpack是我没有的原因。我以前确实拥有它,但自从跑了
npm删除webpack rimraf node_modules