ionic-team / ionic-pwa-toolkit

Build lightning fast Progressive Web Apps with zero config and best practices built-in. Go from zero to production ready with Ionic and Stencil (Web Components).
MIT License
633 stars 74 forks source link

bug(dependencies): installing dependency causes random problems #31

Closed AmitMY closed 6 years ago

AmitMY commented 6 years ago

Resources: Before submitting an issue, please consult our docs.

Stencil version: (run npm list @stencil/core from a terminal/cmd prompt and paste output below):

0.6.1

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com

Current behavior:

git clone https://github.com/ionic-team/ionic-pwa-toolkit.git
cd ionic-pwa-toolkit
npm i
npm start
npm i firebase
npm start

Build info:

preferring built-in module 'punycode' over local alternative at 'D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\punycode\punycode.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning

preferring built-in module 'punycode' over local alternative at 'D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\punycode\punycode.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning

preferring built-in module 'string_decoder' over local alternative at 'D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\string_decoder\lib\string_decoder.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning

preferring built-in module 'string_decoder' over local alternative at 'D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\string_decoder\lib\string_decoder.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning

npm i firebase@4.1.3
npm start

{ SyntaxError: Unexpected token i in JSON at position 0 at error (D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\@stencil\core\node_modules\rollup\dist\rollup.js:170:15) at Object.error (D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\@stencil\core\node_modules\rollup\dist\rollup.js:17509:21) at D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\@stencil\core\node_modules\rollup\dist\rollup.js:17518:29 at code: 'PLUGIN_ERROR', plugin: 'json', id: '\u0000commonjs-proxy:D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\tough-cookie\package.json' }

[ ERROR ] Unexpected token i in JSON at position 0

[ ERROR ] rollup died at D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\@stencil\core\dist\compiler\index.js:2061:19 at Generator.throw () at rejected (D:\dev\pma-backend\ionic-pwa-toolkit\node_modules\@stencil\core\dist\compiler\index.js:2017:65) at

[56:02.0] build failed, watching for changes... in 6.67 s
npm i firebase@latest
npm start

[ WARN ] 'dom-storage' is imported by node_modules\firebase\index.node.js, but could not be resolved – treating it as an external dependency

[ WARN ] 'xmlhttprequest' is imported by node_modules\firebase\index.node.js, but could not be resolved – treating it as an external dependency

[ WARN ] 'dom-storage' is imported by commonjs-external:dom-storage, but could not be resolved – treating it as an external dependency

[ WARN ] 'xmlhttprequest' is imported by commonjs-external:xmlhttprequest, but could not be resolved – treating it as an external dependency

So far, build issues. Now, runtime issues:

Add this to app-home

import firebase from 'firebase';

firebase.initializeApp({ ... config ... });
firebase.auth().signInWithPopup(new firebase.auth.GoogleAuthProvider());

In console:

code: "auth/operation-not-supported-in-this-environment" message: "This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled."

Doing the same thing on an ionic starter does not yield this error.

Other information: Windows, Chrome

arjunyel commented 6 years ago

What version of Node are you running? Id recommend Node 8 LTS or Node 9

AmitMY commented 6 years ago

8.1.2

arjunyel commented 6 years ago

Try deleting the node_modules and updating to node 8.9.4, then installing and trying

AmitMY commented 6 years ago

Upgraded to 9.7.1 actually, same issues

kael commented 6 years ago

@AmitMY Try with stencil 0.6.2 in package.json. There was an issue https://github.com/ionic-team/stencil/issues/452 with import that has been fixed.

AmitMY commented 6 years ago

That's worse :(

[ ERROR ] Cannot find module 'rollup-plugin-node-resolve' at Function.Module._resolveFilename (module.js:557:15) at Function.Module._load (module.js:484:25) at Module.require (module.js:606:17) at require (internal/module.js:11:18) at NodeSystem.get rollup [as rollup] (D:\dev\pma-backend\node_modules\@stencil\core\dist\sys\node\index.js:1043:26) at D:\dev\pma-backend\node_modules\@stencil\core\dist\compiler\index.js:2024:28 at Generator.next () at D:\dev\pma-backend\node_modules\@stencil\core\dist\compiler\index.js:2010:71 at new Promise () at __awaiter$6 (D:\dev\pma-backend\node_modules\@stencil\core\dist\compiler\index.js:2006:12)

jgw96 commented 6 years ago

Hello all! These issues have been fixed in the latest release of Stencil and I just update the toolkit to use the latest release. Thanks for using the Ionic PWA Toolkit!