我正在尝试npm install ngtools/webpack@1.3.3找不到模块:错误:无法解析' module.ngfactory.ts'

时间:2017-07-26 08:11:53

标签: angular webpack universal angular-seed

我正在使用带有webpack的angular version 4.1.0,使用ngtools/webpack@1.3.3找不到错误模块。 我使用此ngtools/webpack@1.3.3

收到这些错误
   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

当我成功更改版本ngtools/webpack@~1.5.0 npm安装时。但它在控制台中提供后出现错误

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",

2 个答案:

答案 0 :(得分:1)

尝试禁用 AoT编译,此错误是通用的,有时在启用AoT时会发生(默认情况下,在目标制作时启用AoT)。

答案 1 :(得分:0)

这是使用ng-seed的角度通用的错误我有安装包 “增强解析”: package.json 中的“3.3.0”。它对我来说很好。