angular - Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' -
just yesterday code working fine, made no changes app module , today when using "ng build --prod" error. know it's not related changes, when pull older branches same error. don't know do, recommendation update each package, after still same error. not sure if guys can help, here's app.module:
import {browsermodule} '@angular/platform-browser'; import {ngmodule} '@angular/core'; import {formsmodule} '@angular/forms'; import {httpmodule} '@angular/http'; import {appcomponent} './app.component'; import {logincomponent} './login/login.component'; import {comparecomponent} './compare/compare.component'; import {routermodule} "@angular/router"; import {comparecardcomponent} './compare/compare-card/compare-card.component'; import {layoutcomponent} './layout/layout.component'; import {comparevaluepipe} "./compare/compare-card/compare-card.pipe"; import {homecomponent} './home/home.component'; import {newlocationcomponent} './new-location/new-location.component'; import {signupcomponent} './signup/signup.component'; import {validateme} "./shared/me.suite/validate.me/validate.me"; import {tagscomponent} './tags/tags.component'; import {googleplacedirective} './third-party/angular2-google-map-auto-complete/directives/googleplace.directive'; import { loadercomponent } './shared/loader/loader.component'; import { alertcomponent } './shared/alert/alert.component'; import {angulartics2googleanalytics, angulartics2module} "angulartics2"; import { overallpipe } './compare/overall.pipe'; import {interactivecomponent} "./question/interactive/interactive.component"; import { formcomponent } './question/form/form.component'; import { kpidesccomponent } './compare/kpi-desc/kpi-desc.component'; import {hashlocationstrategy, location, locationstrategy} "@angular/common"; import {accountapi} "./services/account-api.service"; import {settingsapi} "./services/settings-api.service"; import {dataapi} "./services/data-api.service"; import { zeezorinfocomponent } './zeezor-info/zeezor-info.component'; const routes = [ {path: '', redirectto: '/home', pathmatch: 'full'}, {path: 'compare', component: comparecomponent}, {path: 'new', component: newlocationcomponent}, {path: 'tags', component: tagscomponent}, {path: 'interactive', component: interactivecomponent}, {path: 'form', component: formcomponent}, {path: 'login', component: logincomponent}, {path: 'signup', component: signupcomponent}, {path: 'home', component: homecomponent}, {path: '**', component: homecomponent} ]; @ngmodule({ declarations: [ layoutcomponent, appcomponent, logincomponent, comparecomponent, comparecardcomponent, comparevaluepipe, interactivecomponent, homecomponent, newlocationcomponent, signupcomponent, validateme, tagscomponent, googleplacedirective, loadercomponent, alertcomponent, overallpipe, formcomponent, kpidesccomponent, zeezorinfocomponent ], imports: [ browsermodule, formsmodule, httpmodule, routermodule.forroot(routes), angulartics2module.forroot([ angulartics2googleanalytics ]) ], providers: [accountapi, dataapi, settingsapi, location, {provide: locationstrategy, useclass: hashlocationstrategy}], bootstrap: [appcomponent] }) export class appmodule { constructor(){ let style = document.createelement('link'); style.rel = "stylesheet"; style.href = settingsapi.styleendpoint; window.document.head.appendchild(style); console.log(navigator.useragent); } }
package.json
{ "name": "stack-up", "version": "0.0.0", "license": "mit", "angular-cli": {}, "scripts": { "ng": "ng", "start": "ng serve", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "compile": "ng build --environment=mobile --output-path ../mobile/www/", "compile:prod": "ng build --environment=mobile --target=production --output-path ../mobile/www/", "docker": "ng build --environment=docker", "local": "ng serve --environment=local", "dev": "ng build --environment=dev", "prod": "ng build --environment=prod --target=production --output-path /var/www/html/" }, "private": true, "dependencies": { "@angular/common": "^2.4.0", "@angular/compiler": "^2.4.0", "@angular/core": "^2.4.0", "@angular/forms": "^2.4.0", "@angular/http": "^2.4.0", "@angular/platform-browser": "^2.4.0", "@angular/platform-browser-dynamic": "^2.4.0", "@angular/router": "^3.4.0", "angular2-jwt": "^0.2.2", "angular2-social-login": "^2.1.0", "angulartics2": "^2.2.1", "core-js": "^2.4.1", "rxjs": "^5.0.1", "ts-helpers": "^1.1.1", "tslint": "^3.15.1", "zone.js": "^0.7.2" }, "devdependencies": { "@angular/cli": "1.0.0-beta.31", "@angular/compiler-cli": "^2.4.0", "@types/jasmine": "2.5.38", "@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-coverage-istanbul-reporter": "^0.2.0", "protractor": "~5.1.0", "ts-node": "1.2.1", "tslint": "^4.3.0", "typescript": "~2.0.0" } }
i had similar problem yesterday (same error message) , fixed based on angular-cli issue:
https://github.com/angular/angular-cli/issues/7125
the fix pin enhanced-resolve
version 3.3.0
in package.json, delete node_modules, run npm install
, build again. seems have fixed problem of people in issue thread.
the newer version of enhanced-resolve seems causing problem.
if still breaks make sure have correct enhanced-resolve version running npm ls enhanced-resolve
.
Comments
Post a Comment