我正尝试将PWA功能添加到Angular 8项目(由ng new
生成)中。
ng add @angular/pwa --project projectname
得到错误:
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
有什么想法的人吗?
(ng
的其余命令都可以正常工作,我可以提供服务,制作生产广告等等)
答案 0 :(得分:0)
谁会想到?!
经过数小时的尝试,事实证明原因是src/app/app.module.ts
中的以下代码行:
import {environment as env} from '../environments/environment';
如果不带别名导入environment
,一切正常。奇怪...
ng version
:
Angular CLI: 8.3.19
Node: 10.16.3
OS: darwin x64
Angular: 8.2.14