ng build -prod Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory'
OS?
Windows 7 64 bit
Versions.
@angular/cli: 1.0.0-beta.30 node: 7.4.0 os: win32 x64 @angular/common: 2.4.6 @angular/compiler: 2.4.6 @angular/core: 2.4.6 @angular/forms: 2.4.6 @angular/http: 2.4.6 @angular/platform-browser: 2.4.6 @angular/platform-browser-dynamic: 2.4.6 @angular/router: 3.4.6 @angular/cli: 1.0.0-beta.30 @angular/compiler-cli: 2.4.6
Repro steps.
App started using angular cli
The log given by the failure.
This is from my command line:
ERROR in Unexpected value 'null' declared by the module 'AppModule in C:/Users/T haniri/Desktop/freecodecamp/myroute/src/app/app.module.ts'
ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'C:\Users\Thaniri\Desktop\freecodecamp\myroute\src' @ ./src/main.ts 3:0-74 @ multi ./src/main.ts
Mention any other details that might be useful.
ng serve works fine, its just ng build -prod
Here are the contents of my main.ts file: `import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { enableProdMode } from '@angular/core'; import { environment } from './environments/environment'; import { AppModule } from './app/app.module';
if (environment.production) { enableProdMode(); }
platformBrowserDynamic().bootstrapModule(AppModule); `
If there is more information needed, please let me know. I am trying to learn how to deploy my Angular website.
I had the the same problem. I fixed it by using ng-packagr v3.0.3 instead of v2.4.5 when building the npm-package.
+1 linux mint
ERROR in this._input.charCodeAt is not a function ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/vs/Work/GoFactTables/GoFactFrontend/src' @ ./src/main.ts 5:0-74 @ multi ./src/main.ts
I have the same issue which you are facing . have you find any solution if yes then please suggest me.
I know this call is closed, but its the first link I found when googling, so here is my solution.
ERROR in ./src/main.server.ts
Module not found: Error: Can't resolve './app/app.server.module.ngfactory'
Using Angular 7.1.4, reason was I enabledIvy after upgrading from 6 to 7.
"angularCompilerOptions": {
"enableIvy": true
}
Removed the flag and all was good.
Ivy is still in Beta and should not be used in production see issue 21706
For me it was having "rootDir" in my tsconfig.json ... (I needed to remove it)
This command is 100% work for solving this problem. npm install [email protected]
For me it worked with this solution.
/ \ _ __ __ _ _ | | __ _ _ __ / | | | |
/ △ \ | ' \ / _ | | | | |/ _ | '| | | | | | |
/ ___ | | | | (| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/
@angular/cli: 1.0.1
node: 6.14.3
os: linux x64
@angular/common: 4.3.5
@angular/compiler: 4.3.5
@angular/core: 4.3.5
@angular/forms: 4.3.5
@angular/http: 4.3.5
@angular/platform-browser: 4.3.5
@angular/platform-browser-dynamic: 4.3.5
@angular/router: 4.3.5
@angular/cli: 1.0.1
@angular/compiler-cli: 4.3.5
and this is the error
ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/var/www/html/v2site/lite_frontend/src' @ ./src/main.ts 5:0-74 @ multi ./src/main.ts
please suggest solution asap
@ervivekmahajan please read all the comments asap
Still having this issue. All the proposed solutions don't work: no absolute paths, rootDir doesnt exist, aot=false doesn't work since buildOptimizer requires AOT. Using Angular 7.2. Any help?
I still have this issue as well. I checked the various solutions but none worked for me.
s/@types/googlemaps/index.d.ts (1977,5): Duplicate identifier 'OK'. u/node_modules/@types/googlemaps/index.d.ts (2124,33): Duplicate identifier 'DEFAULT'. plz help
@WiL-dev : I can confirm it works fine on 1.0.0-rc1. Thanks!
Hello
i am using same version but not working. can help how to fixed this
Version:
@angular/cli: 1.0.0-rc.1 node: 8.11.4 os: win32 x64 @angular/common: 2.4.10 @angular/compiler: 2.4.10 @angular/core: 2.4.10 @angular/forms: 2.4.10 @angular/http: 2.4.10 @angular/platform-browser: 2.4.10 @angular/platform-browser-dynamic: 2.4.10 @angular/router: 3.4.10 @angular/cli: 1.0.0-rc.1 @angular/compiler-cli: 2.4.10
Error ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'C:\Users\gazala\Desktop\GCDB_Workspace\GCDB6-Portal-Final\src' @ ./src/main.ts 5:0-74 @ multi ./src/main.ts
This command is 100% work for solving this problem. npm install [email protected]
This solution is not work.
This is my package version
Angular CLI: 1.7.4 Node: 8.11.4 OS: win32 x64 Angular: 2.4.10 ... common, compiler, compiler-cli, core, forms, http ... platform-browser, platform-browser-dynamic
@angular/cli: 1.7.4 @angular/router: 3.4.10 @angular/tsc-wrapped: 0.5.2 @angular-devkit/build-optimizer: 0.3.2 @angular-devkit/core: 0.3.2 @angular-devkit/schematics: 0.3.2 @ngtools/json-schema: 1.2.0 @ngtools/webpack: 1.10.2 @schematics/angular: 0.3.2 @schematics/package-update: 0.3.2 typescript: 2.9.2 webpack: 3.11.0

angular 7 to 8 update face issue
- remove node_modules dir.
- execute 'npm cache clean --force'.
- delete package-lock.json. after these. aot is success! hope help u.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.