0

I'm trying to add PWA capabilities into the Angular 8 project (generated with ng new).

ng add @angular/pwa --project projectname

Got the error:

Installing packages for tooling via npm.

+ @angular/pwa@0.803.19
added 5 packages from 2 contributors and audited 18965 packages in 6.091s
found 0 vulnerabilities

Installed packages for tooling via npm.
Cannot read property 'length' of undefined

Any thoughts guys?

(the rest of ng commands work just fine, I'm able to serve, build production ad so on)

  • Did you replace "projectname" with the actual name of your project? – Damian C Nov 18 '19 at 15:58
  • @DamianC yes, exactly with the key name under `projects` of `angular.json` (the only and the same as `defaultProject`. The project name has a dash, like `brand-web` (does it matter btw?) – georgiy.zhuravlev Nov 18 '19 at 16:02

1 Answers1

0

Who would have thought?!

After hours of trying, it turned out that the reason is this line of code in src/app/app.module.ts:

import {environment as env} from '../environments/environment';

If you import environment without alias everything works fine. Weird...

ng version:

Angular CLI: 8.3.19
Node: 10.16.3
OS: darwin x64
Angular: 8.2.14