我正在使用帶有webpack的angular version 4.1.0,使用ngtools/[email protected]。 3找不到錯誤模塊。 當我更改版本ngtools/[email protected]~1.5.0 NPM安裝成功地我收到使用該ngtools/[email protected]我想npm install ngtools/[email protected]找不到模塊:錯誤:無法解析'module.ngfactory.ts'
Module not found: Error: Can't resolve
'./app/app.browser.module.ngfactory' in package.json (relative path:
./src/client)
Field 'browser' doesn't contain a valid alias configuration after using description file: (relative path: ./src/client)
using description file: package.json (relative path: ./src/client/app/app.browser.module.ngfactory)
Error: . lazy Module not found: Error: Can't resolve
'/media/ongraph/new volume
1/EponymAngularproject/development/28junIE-angularuniversal/classicspecs-webpack/src/client/app/modules/checkout-module/checkout.module.ngfactory.ts'
in '/media/ongraph/new volume
1/EponymAngularproject/development/28junIE-angularuniversal/classicspecs-webpack'
resolve '/media/ongraph/new volume
1/EponymAngularproject/development/28junIE-angularuniversal/classicspecs-webpack/src/client/app/modules/checkout-module/checkout.module.ngfactory.ts'
in '/media/ongraph/new volume
1/EponymAngularproject/development/28junIE-angularuniversal/classicspecs-webpack'
using description file: /media/ongraph/new volume
1/EponymAngularproject/development/28junIE-angularuniversal/classicspecs-webpack/package.json
(relative path: .)
Field 'browser' doesn't contain a valid alias configuration after using description file: /media/ongraph/new volume
1/EponymAngularproject/development/28junIE-angularuniversal/classicspecs-webpack/package.json
(relative path: .)
using description file: /media/ongraph/new volume 1/EponymAngularproject/development/28junIE- angularuniversal/classicspecs-webpack/package.json
(relative path:
./src/client/app/modules/checkout-module/checkout.module.ngfactory.ts)
no extension
Field 'browser' doesn't contain a valid alias configuration
.module.ngfactory.ts doesn't exist
@ . lazy @ ./~/@angular/core/@angular/core.es5.js @ ./~/@angular/platform-browser/@angular/platform-browser.es5.js @
./src/client/main-browser.ts
這些錯誤。但服務於控制檯後
Uncaught Error: No NgModule metadata found for 't'.
at t.resolve (app.a3216cb….bundle.js:1)
at t.getNgModuleMetadata (app.a3216cb….bundle.js:1)
at t._loadModules (app.a3216cb….bundle.js:1)
at t._compileModuleAndComponents (app.a3216cb….bundle.js:1)
at t.compileModuleAsync (app.a3216cb….bundle.js:1)
at e._bootstrapModuleWithZone (app.a3216cb….bundle.js:1)
at e.bootstrapModule (app.a3216cb….bundle.js:1)
at r (app.a3216cb….bundle.js:1)
at Object.r [as a] (app.a3216cb….bundle.js:1)
at Object.311 (app.a3216cb….bundle.js:1)
"@angular/common": "~4.1.0",
"@angular/core": "~4.1.0",
"@angular/forms": "~4.1.0",
"@angular/http": "~4.1.0",
"@angular/platform-browser": "~4.1.0",
"@angular/platform-browser-dynamic": "~4.1.0",
"@angular/platform-server": "~4.1.0",
模塊未找到錯誤,只能在生產環境中使用,它在開發環境中工作正常。 –