Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Build the SPA app with NPM error npm run build:prod #253

Closed
ASADeveloper opened this issue Jul 31, 2017 · 7 comments
Closed

Build the SPA app with NPM error npm run build:prod #253

ASADeveloper opened this issue Jul 31, 2017 · 7 comments

Comments

@ASADeveloper
Copy link

Hi,

I'm following every line of the wiki for the second time and get exact same error when running
"npm run build:prod" from the commandline to build the SPA.

The error itself is..
ERROR in ./Client/main.ts
Module not found: Error: Can't resolve './$$_gendir/modules/app.module.ngfactory' in 'C:\Devlop\Repos\eShopOnContainers\src\Web\WebSPA\Client'
@ ./Client/main.ts 4:0-78
@ multi ./Client/main.ts

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build:prod"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! eshopaspnetnetcoredockerspa@0.0.0 build:prod: ng build --prod --aot --extract-css
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eshopaspnetnetcoredockerspa@0.0.0 build:prod script 'ng build --prod --aot --extract-css'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the eshopaspnetnetcoredockerspa package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng build --prod --aot --extract-css
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs eshopaspnetnetcoredockerspa
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls eshopaspnetnetcoredockerspa
npm ERR! There is likely additional logging output above.

Just like the wiki says, I installed 6.11 Node and npm 3.10.10 as you also can see in the above error information.

@ASADeveloper
Copy link
Author

I'm not very good at Angular but it seems to be an issue on that address. Just a few minutes after I posted this issue I found a lot of posts about it in the angular repository. I followed one of the suggestions and it works for me now.
In this section:
https://github.com/dotnet-architecture/eShopOnContainers/wiki/06.-Setting-the-Web-SPA-application-up#build-the-spa-app-with-npm

Instead of just 'npm install', I ran 'npm install enhanced-resolve@3.3.0'.

After that everything worked fine.

@CESARDELATORRE : Perhaps an expert on Angular should look at this or wiki should be updated with this issue/command.

A couple of related source on angular:
angular/angular-cli#4551
angular/angular-cli#7125
suggested workaround that worked for me:
angular/angular-cli#7113 (comment)

I leave this open for other who might have the same issue.

Feel free to close it when you like.

@Shawn-Fan
Copy link

Shawn-Fan commented Aug 1, 2017

Thanks, it works in Mac OS as well

@CESARDELATORRE
Copy link
Collaborator

We'll research this issue. Looks like changes in npm or dependecies might be breaking it. For now, if you have this issue, run 'npm install enhanced-resolve@3.3.0' instead 'npm install'.

@CESARDELATORRE
Copy link
Collaborator

Not sure what's the issue here but I'm testing in a clean machine, clean "git pull of the dev branch repo", with the latest NPM version, regular "npm install" and then "npm run build:prod" and the SPA application is working properly.
I didn't need to run "npm install enhanced-resolve@3.3.0"...
See:
image
image

@infofromca
Copy link

infofromca commented Aug 5, 2017

main-err
node, npm both are latest

@infofromca
Copy link

must follow @ASADeveloper
@CESARDELATORRE please reopen this issue

@ASADeveloper
Copy link
Author

@CESARDELATORRE Perhaps the reason that it works for you is because you used the 'dev' branche instead of the 'master' as advised in the Wiki.

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