webmaxru / pwa-workshop-angular

Demo App for Angular Mobile Toolkit workshop
40 stars 7 forks source link

getting error installing ng-pwa-tools and running ngu-sw-manifest #1

Closed chaoranxie closed 5 years ago

chaoranxie commented 7 years ago

Tried to follow http://slides.com/webmax/pwa-graz#/24 but getting errors

npm install --save ng-pwa-tools
angular-pwa-starter@0.0.0 /Users/chaoranxie/dev/pwa-workshop-angular
├── UNMET PEER DEPENDENCY @angular/animations@4.1.1
├── UNMET PEER DEPENDENCY @angular/common@4.1.1
├── UNMET PEER DEPENDENCY @angular/compiler@4.1.1
├── UNMET PEER DEPENDENCY @angular/compiler-cli@4.1.1
├── UNMET PEER DEPENDENCY @angular/core@4.1.1
├── UNMET PEER DEPENDENCY @angular/http@4.1.1
└── ng-pwa-tools@0.0.15

Not sure if package.json needs to be updated.

ngu-sw-manifest --out dist/ngsw-manifest.json

Error: Cannot find module 'reflect-metadata'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/chaoranxie/.nvm/versions/node/v6.10.3/lib/node_modules/ng-pwa-tools/lib/sw-manifest/index.js:3:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
chaoranxie commented 7 years ago

oddly enough i can run ./node_modules/ng-pwa-tools/bin/ngu-sw-manifest.js --out dist/ngsw-manifest.json without error, so i am not sure if i am doing something wrong

chaoranxie commented 7 years ago

./node_modules/ng-pwa-tools/bin/ngu-sw-manifest.js --module src/app/app.module.ts --out dist/ngsw-manifest.json will give you following error, i had the same issue with my own project and filed an issue here https://github.com/alxhub/io17/issues/2 with ng-pwa-tools

/Users/chaoranxie/dev/pwa-workshop-angular/node_modules/hammerjs/hammer.js:2643
})(window, document, 'Hammer');
   ^
ReferenceError: window is not defined
    at Object.<anonymous> (/Users/chaoranxie/dev/pwa-workshop-angular/node_modules/hammerjs/hammer.js:2643:4)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/chaoranxie/dev/pwa-workshop-angular/src/app/app.module.ts:9:1)
    at Module._compile (module.js:570:32)
JanneHarju commented 6 years ago

I am also same error with this command: ./node_modules/.bin/ngu-sw-manifest --module src/app/app.module.ts \ --out dist/ngsw-manifest.json I assume that this might be to do something with node.js. There might be node server behind that command and node does not have windows (like in your situation) or localStorage (like in my). But when I did remove myt localStorage reference in my app.module.ts then I get this kind of message: "Error: C:\folder\folder1\src\app\app.module.ts contains no @NgModules"

webmaxru commented 5 years ago

There is a new version of Angular PWA workshop released:

This repo will no longer be maintained.