Skip to content

"ng build --prod" error #6020

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
kilgoretrout opened this issue Apr 20, 2017 · 2 comments
Closed

"ng build --prod" error #6020

kilgoretrout opened this issue Apr 20, 2017 · 2 comments

Comments

@kilgoretrout
Copy link

kilgoretrout commented Apr 20, 2017

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.0-rc.1
node: 7.7.2
os: win32 x64
@angular/animations: 4.0.2
@angular/common: 4.0.2
@angular/compiler: 4.0.2
@angular/compiler-cli: 4.0.2
@angular/core: 4.0.2
@angular/flex-layout: 2.0.0-beta.7
@angular/forms: 4.0.2
@angular/http: 4.0.2
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 4.0.2
@angular/platform-browser-dynamic: 4.0.2
@angular/platform-server: 4.0.2
@angular/router: 4.0.2
@angular/cli: 1.0.0-rc.1

Repro steps.

When running the following build command for my project I get an error...

ng build --prod

The following build commands work...

ng build
ng build --prod --aot false

The log given by the failure.

ERROR in Illegal state: symbol without members expected, but got {"filePath":"D:/Projects/made-naturally/node_modules/@angular/platform-browser/platform-browser.d.ts","name":"platform_browser_private","members":["BROWSER_SANITIZATION_PROVIDERS"]}.

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'D:\Projects\made-naturally\src'
@ ./src/main.ts 4:0-74
@ multi ./src/main.ts

Desired functionality.

Mention any other details that might be useful.

All the following build commands work...

ng build
ng build --prod --aot false

@kilgoretrout kilgoretrout changed the title ng build --prod throws an error "ng build --prod" throws an error Apr 20, 2017
@kilgoretrout kilgoretrout changed the title "ng build --prod" throws an error "ng build --prod" error Apr 20, 2017
@kilgoretrout
Copy link
Author

To fix this I ran the following commands from the angular CLI install guide, I now get a clean prod aot build.

Note: the section that I think fixed the issues was removing all modules so that they were refreshed, make sure that part runs correctly and that the files are not locked out etc. so you get a clean install.

npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli

To update Angular CLI to a new version, you must update both the global package and your project's local package.

Global package:

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest

Local project package:

rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev @angular/cli@latest
npm install

@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 7, 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

1 participant