cli v6.0.0-rc.4
From an Angular 5 project generated with --service-worker
:
Error: Expected to find an ngsw-config.json configuration file in the /path/to/app folder.
Migration from CLI 1.7 to 6.0 should move /src/ngsw-config.json
to /ngsw-config.json
if existing.
same problem here...
Actions: keep the file at the current path, but add argument option to the build and set the option properly if the file exists.
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 /
but ngswConfigPath
option isn't defined in the cli json schema... editor is reporting it as invalid...
Is the schema.json
updated in https://github.com/Brocco/devkit/commit/cea4245e8c7539a6a1b90d70388aae60d3a92bdd released?
@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.
@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.
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.
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.
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._
Most helpful comment
I resolved my issue on windows by changing the path created in
angular.json
duringng upgrade
from"ngswConfigPath": "/src/ngsw-config.json",
to
"ngswConfigPath": "src/ngsw-config.json",
Removing the leading /