Skip to content

ng build --prod error because ngsw-config.json not moved during migration #10357

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
cyrilletuzi opened this issue Apr 16, 2018 · 9 comments
Closed
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone

Comments

@cyrilletuzi
Copy link
Contributor

Versions

cli v6.0.0-rc.4

Repro steps

From an Angular 5 project generated with --service-worker:

  • update and migrate to v6
  • ng build --prod

Observed behavior

Error: Expected to find an ngsw-config.json configuration file in the /path/to/app folder.

Desired behavior

Migration from CLI 1.7 to 6.0 should move /src/ngsw-config.json to /ngsw-config.json if existing.

@cyrilletuzi cyrilletuzi changed the title ng build --prod erreur because ngsw-config.json not moved during migration ng build --prod error because ngsw-config.json not moved during migration Apr 16, 2018
@filipesilva filipesilva added this to the v6.0.0 milestone Apr 16, 2018
@ghost
Copy link

ghost commented Apr 23, 2018

same problem here...

@hansl hansl added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Apr 23, 2018
@hansl
Copy link
Contributor

hansl commented Apr 23, 2018

Actions: keep the file at the current path, but add argument option to the build and set the option properly if the file exists.

@Brocco Brocco self-assigned this Apr 25, 2018
Brocco added a commit to Brocco/devkit that referenced this issue Apr 25, 2018
@trojanc
Copy link

trojanc commented May 8, 2018

I resolved my issue on windows by changing the path created in angular.json during ng upgrade from
"ngswConfigPath": "/src/ngsw-config.json",
to
"ngswConfigPath": "src/ngsw-config.json",

Removing the leading /

@royling
Copy link
Contributor

royling commented May 27, 2018

but ngswConfigPath option isn't defined in the cli json schema... editor is reporting it as invalid...

Is the schema.json updated in Brocco/devkit@cea4245 released?

@markau
Copy link

markau commented May 27, 2018

@royling just delete the whole line "ngswConfigPath": "/src/ngsw-config.json", from angular.json. It seems to still register the service worker OK. I got this from SO.

@royling
Copy link
Contributor

royling commented May 30, 2018

@markau Thanks, it also needs to move src/ngsw-config.json to the project root dir (same as angular.json). I guess that's how service worker works implicitly within the new CLI.

@ranbuch
Copy link

ranbuch commented Feb 19, 2019

I was having the same problem when my config file configure like this:
"ngswConfigPath": "src/ngsw-config.json"
I was trying to build ng b --prod from src/app/shared instead of building from the root folder.
Building from the root folder fix the issue for me.

@SamiHK
Copy link

SamiHK commented Apr 19, 2019

Well. My "ngsw-config.json" file is in the root directory and in my angular.json I set
"ngswConfigPath": "./ngsw-config.json" AND its working smoothly. So idea is to provide the path of ngsw-config.json file simple.

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

9 participants