ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2017-12-10T11:30:25.965Z
Hash: 31f71472581894cb8296
Time: 6476ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 3.43 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 1.01 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 33.7 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 856 kB [initial] [rendered]

ERROR in ./src/main.ts
Module build failed: Error: Angular Compiler was detected but it was an instance of the wrong class.
This likely means you have several @ngtools/webpack packages installed. You can check this with `npm ls @ngtools/webpack`, and then remove the extra copies.
    at Object.ngcLoader (D:web_srcHelloAngular
ode_modules@ngtoolswebpacksrcloader.js:458:19)
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in ./src/polyfills.ts
Module build failed: Error: Angular Compiler was detected but it was an instance of the wrong class.
This likely means you have several @ngtools/webpack packages installed. You can check this with `npm ls @ngtools/webpack`, and then remove the extra copies.
    at Object.ngcLoader (D:web_srcHelloAngular
ode_modules@ngtoolswebpacksrcloader.js:458:19)
 @ multi ./src/polyfills.ts

webpack: Failed to compile.

npm ls @ngtools/webpack
hello-angular@0.0.0 D:web_srcHelloAngular
+-- UNMET PEER DEPENDENCY @angular-devkit/schematics@0.0.41 extraneous
+-- @angular/cli@1.6.0
| +-- UNMET PEER DEPENDENCY @angular-devkit/schematics@0.0.41 -> D:web_srcHelloAngular
ode_modules\_@angular-devkit_schematics@0.0.41@@angular-devkitschematics
| | `-- UNMET PEER DEPENDENCY @angular-devkit/schematics@0.0.40
| `-- @ngtools/webpack@1.9.0  -> D:web_srcHelloAngular
ode_modules\_@ngtools_webpack@1.9.0@@ngtoolswebpack
`-- @ngtools/webpack@1.9.0  extraneous

npm ERR! peer dep missing: @angular-devkit/schematics@0.0.40, required by @schematics/angular@0.1.10
npm ERR! extraneous: @ngtools/webpack@1.9.0 D:web_srcHelloAngular
ode_modules@ngtoolswebpack
npm ERR! peer dep missing: @angular-devkit/schematics@0.0.40, required by @schematics/angular@0.1.10

ng -v
_                      _                 ____ _     ___
/    _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
/ △  | ’_  / _` | | | | |/ _` | ’__|   | |   | |    | |
/ ___ | | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
|___/

Angular CLI: 1.6.0
Node: 6.11.1
OS: win32 x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.0
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2017-12-10T11:44:35.998Z
Hash: 78b77921384d5e249049
Time: 12806ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 20.8 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 560 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 34.6 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 7.14 MB [initial] [rendered]

webpack: Compiled successfully.




直接暴力解决,删掉node_modules,重新cnpm i

I recently had a similar problem with @angular/cli@1.4.9 and @ngtools/webpack@1.7.4

├─┬ @angular/cli@1.4.9
│ └── @ngtools/webpack@1.7.4
└── @ngtools/webpack@1.7.4
Follow the instructions here https://github.com/angular/angular-cli/wiki/stories-1.0-update 
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli

npm uninstall -g @angular/cli
npm uninstall --save-dev @angular/cli 

rm -rf node_modules dist
npm cache clean

npm install -g @angular/cli@latest
npm install --save-dev @angular/cli@latest
npm install   
https://stackoverflow.com/questions/46188636/module-build-failed-error-aotplugin-was-detected-but-it-was-an-instance-of-the

分类: 开发笔记

admin

少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。

发表评论

电子邮件地址不会被公开。 必填项已用*标注