Skip to content

Uncaught Error: Cannot find module "./$$_gendir/app/app.module.ngfactory" #4294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
manuelfink opened this issue Jan 30, 2017 · 4 comments
Closed

Comments

@manuelfink
Copy link

Compiling an app with angular-cli with

ng build --prod --env=prod --aot

I end up the the following error in the browser

Uncaught Error: Cannot find module "./$$_gendir/app/app.module.ngfactory"
    at Object.<anonymous> (main.925377c….bundle.js:31562)
    at r (bootstrap 6ea98d3…:52)
    at Object.<anonymous> (main.925377c….bundle.js:51201)
    at r (bootstrap 6ea98d3…:52)
    at window.webpackJsonp (bootstrap 6ea98d3…:23)
    at main.925377c….bundle.js:1

the code causing the error is:

/***/ },
/* 208 */
/***/ function(module, exports, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__polyfills_ts__ = __webpack_require__(285);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__polyfills_ts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__polyfills_ts__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__environments_environment__ = __webpack_require__(284);
throw new Error("Cannot find module \"./$$_gendir/app/app.module.ngfactory\"");
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_platform_browser__ = __webpack_require__(270);

Versions

MacOS 10.12.2
angular-cli: 1.0.0-beta.21
node: 6.9.1
os: darwin x64

Any idea what may be the origin of the error?

@Meligy
Copy link
Contributor

Meligy commented Feb 1, 2017

Can you share a repository showing a sample project with this error?

That is, create a new Angular CLI project, and then try to reproduce the error?

Thanks.

@annvnzndrvn
Copy link

Having same issue here.

Uncaught Error: Cannot find module "./$$_gendir/app/app.module.ngfactory" at Object.<anonymous> (main.78a068d….bundle.js:21992) at r (bootstrap 3bff2fc…:52) at Object.<anonymous> (main.78a068d….bundle.js:34716) at r (bootstrap 3bff2fc…:52) at window.webpackJsonp (bootstrap 3bff2fc…:23) at main.78a068d….bundle.js:1

This is happening only when serving dist folder content generated with ng build --prod --env=prod --aot and directly on the log output after running ng build command. When skipping --aot parameter it returns no error.

I finally managed to resolve it by deleting every single test file in my application folder. I was working under the assumption that angular-cli would exclude these files by default but it seems it's not the case with my current setup (using [email protected]).

@filipesilva
Copy link
Contributor

Closing as there was no reproducion given by original author.

@annvnzndrvn you're using a pretty old version, I recommend updating.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants