Skip to content

ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' #7125

Closed

Description

@marciomsm

I am getting ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' when I run ng build --prod, but if I run the command ng build --env=prod I get success.

Do we have any differences between these commands?

Activity

  1. ajalmaguer commented on Jul 24, 2017

    @ajalmaguer

    Happens for me too. These are the versions of my project:

    @angular/cli: 1.1.3
    node: 6.11.0
    os: darwin x64
    @angular/animations: 4.2.4
    @angular/common: 4.2.4
    @angular/compiler: 4.2.4
    @angular/core: 4.2.4
    @angular/forms: 4.2.4
    @angular/http: 4.2.4
    @angular/platform-browser: 4.2.4
    @angular/platform-browser-dynamic: 4.2.4
    @angular/router: 4.2.4
    @angular/cli: 1.1.3
    @angular/compiler-cli: 4.2.4
    @angular/language-service: 4.2.4
    
  2. marciomsm commented on Jul 24, 2017

    @marciomsm
    Author

    I solved it setting the zone.js version to 0.8.14. I don't know if we have an issue on Angular-CLI or on zone.js.

  3. marius-oprea commented on Jul 24, 2017

    @marius-oprea

    I did a successful ng build -prod a couple of hours ago, but now I get the same error without changing nothing to my project.

  4. bcravens commented on Jul 24, 2017

    @bcravens

    @marius-oprea same thing just happened to me.

  5. mattrichard commented on Jul 24, 2017

    @mattrichard

    I'm getting the same error too. Updating zone.js did not work for me.

  6. jh-code commented on Jul 24, 2017

    @jh-code

    Happening here as well. Very odd. Tried messing around with a lot of different versions of Angular, Angular CLI, Zone.js and others with no luck.

  7. bcravens commented on Jul 24, 2017

    @bcravens

    We eventually solved it by mass updating our node packages. Not sure which one solved the problem, wasn't zone.js though.

  8. marius-oprea commented on Jul 24, 2017

    @marius-oprea

    updating to @angular/cli 1.2.4 and the other packages to the latest version solved the issue for me.

  9. marciomsm commented on Jul 24, 2017

    @marciomsm
    Author

    Change your package.json to zone.js: 0.8.14. Delete node_modules folder and run npm install again.

  10. EricABC commented on Jul 24, 2017

    @EricABC

    The patch rc.1 was released to address this, but others still indicate problems with rc.1 here: #7113. rc.1 fixed most of my apps, but for some sample projects I was using a tsconfig with 'include: []', relying on ng to pass my entrypoint to the compiler. When using AOT you will get this error even in rc.1 unless you include the entry points explicitly in tsconfig.

  11. joseph-mcallister commented on Jul 24, 2017

    @joseph-mcallister

    None of the package updating worked for me but adding enhanced-resolve: 3.3.0 did. See #4551

  12. tianyuanzhonglu commented on Jul 25, 2017

    @tianyuanzhonglu

    @angular/cli: 1.2.4 fix the problem

  13. 41 remaining items

  14. manishit56 commented on Sep 22, 2017

    @manishit56

    below command solved my issue
    npm install enhanced-resolve@3.3.0

  15. added a commit that references this issue on Sep 24, 2017
  16. justin48 commented on Oct 18, 2017

    @justin48

    removing node_modules and running npm install worked for me.

  17. devssharma commented on Nov 11, 2017

    @devssharma

    Sloved !!
    I had this issue when i was trying the execute ng build -aot command.
    problem slove for me when i changed the version of "@angular/cli": "1.2.0" to "@angular/cli": "1.3.0",

  18. imichelakos commented on Nov 14, 2017

    @imichelakos

    Sloved !!
    I had this issue when i was trying the execute ng build -prod command.
    Problem solved by updating the version of "@angular/cli": "1.0.0" to "@angular/cli": "1.3.0".

  19. scharlo commented on Feb 1, 2018

    @scharlo

    None of the solutions worked for me, because the issue was about memory. Maybe the command below could work for those who couldn't find a solution. This solved the issue in my case.

    node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod

  20. bharath005 commented on Apr 5, 2018

    @bharath005

    Could not resolve "./components/template/template.module" from "E:/vat_frontend/src/app/app.module.ts".

  21. tayyab786 commented on Jun 21, 2018

    @tayyab786

    import React, { Component } from 'react';
    import logo from './logo.svg';
    import './image.css';
    import Dropdown from 'react-dropdown';
    import axios from 'axios';
    import { AppRegistry, View, Image,Text, } from 'react-native';
    // import 'react-dropdown/style.css';

    class App extends Component {
    state=
    {
    selectedFile:null
    }
    fileSelectHandler=event=>{
    // console.log(event.target.files[0]);
    this.setState({
    selectedFile:event.target.files[0]
    })
    // fileUploadHandler=() =>
    // {
    // axios.post('')
    //
    // }
    }

    render() {

    return (
        <div className="image-upload">
        <View>
        <Image
         source={require('D:\ofc\firstapp\src\bmw.jpg')}
       />
       </View>
    
        </div>
    
    
    );
    

    }
    }

    export default App;

    m geeting error of
    ./src/practicee.js
    Module not found: Can't resolve 'D:ofc irstappsrc�mw.jpg' in 'D:\ofc\firstapp\src'

    can anyone help me

  22. tayyab786 commented on Jun 21, 2018

    @tayyab786

    geeting error of
    ./src/practicee.js
    Module not found: Can't resolve 'D:ofc irstappsrc�mw.jpg' in 'D:\ofc\firstapp\src'

    can anyone help me

  23. tayyab786 commented on Jun 21, 2018

    @tayyab786

    import React, { Component } from 'react';
    import logo from './logo.svg';
    import './image.css';
    import Dropdown from 'react-dropdown';
    import axios from 'axios';
    import { AppRegistry, View, Image,Text, } from 'react-native';

    class App extends Component {
    state=
    {
    selectedFile:null
    }
    fileSelectHandler=event=>{
    this.setState({
    selectedFile:event.target.files[0]
    })

    }

    render() {

    return (
        <div className="image-upload">
        <View>
        <Image
         source={require('D:\ofc\firstapp\src\bmw.jpg')}
       />
       </View>
    
        </div>
    
    
    );
    

    }
    }

    export default App;

  24. KhizerRehan commented on Jun 24, 2018

    @KhizerRehan

    Trying to build AOT but still unsuccessful! Even tried #7113 solution. But still error persists.kindly help Thanks!
    @filipesilva @Brocco

    current cli version installed:
    screenshot_1

    Error screen shot
    screenshot_2

  25. ssjoy76 commented on Sep 25, 2018

    @ssjoy76

    This command is 100% work for solving this problem.
    npm install enhanced-resolve@3.3.0

  26. rameshpraja commented on Oct 2, 2018

    @rameshpraja

    I have the same issue
    Angular CLI version : 1.0.0
    angular version : 4
    node : v8.11.3
    When I fired ng build --prod then throwing the below error

    ERROR in ./src/main.ts
    Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/user2/Project/test/streetworkapp/material/loan_calculator/src'
    @ ./src/main.ts 5:0-74
    @ multi ./src/main.ts

    ERROR in ./src/$$_gendir async
    Module not found: Error: Can't resolve '/home/user2/Project/test/streetworkapp/material/loan_calculator/src/$$_gendir/app/routes/home/home.module.ngfactory.ts' in '/home/user2/Project/test/streetworkapp/material/loan_calculator/src/$$_gendir'
    @ ./src/$$_gendir async
    @ ./~/@angular/core/@angular/core.es5.js
    @ ./src/main.ts
    @ multi ./src/main.ts

    ERROR in ./src/$$_gendir async
    Module not found: Error: Can't resolve '/home/user2/Project/test/streetworkapp/material/loan_calculator/src/$$_gendir/app/routes/loan/loan.module.ngfactory.ts' in '/home/user2/Project/test/streetworkapp/material/loan_calculator/src/$$_gendir'
    @ ./src/$$_gendir async
    @ ./~/@angular/core/@angular/core.es5.js
    @ ./src/main.ts
    @ multi ./src/main.ts

    I have tried with upgrading the @angular/cli latest version as well but I am not able to resolved that production issues.

    Please expert team help me.

  27. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-bot

    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.

  28. locked and limited conversation to collaborators on Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions