VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.88k forks source link

Cordova : App fails on startup (android emulator) #1798

Closed eric-burel closed 5 years ago

eric-burel commented 6 years ago

Hi, The very last version of vulcan (1.8.2) fails on startup on my machine when running an android emulator.

Here are the logs for a bare installation of the Vulcan Starter repo, after adding the android platform.

meteor run android
[[[[[ ~/Websites/Vulcan-Starter ]]]]]         

=> Started proxy.                             
=> Started MongoDB.                           
W20180104-11:58:23.187(1)? (STDERR) Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in  React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs
W20180104-11:58:23.353(1)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20180104-11:58:23.354(1)? (STDERR) While this implementation will work correctly, it is known to be
W20180104-11:58:23.355(1)? (STDERR) approximately three times slower than the native implementation.
W20180104-11:58:23.355(1)? (STDERR) In order to use the native implementation instead, run
W20180104-11:58:23.356(1)? (STDERR)           
W20180104-11:58:23.356(1)? (STDERR)   meteor npm install --save bcrypt
W20180104-11:58:23.357(1)? (STDERR)           
W20180104-11:58:23.357(1)? (STDERR) in the root directory of your application.
W20180104-11:58:23.409(1)? (STDERR) Warning: Accessing createClass via the main React package is deprecated, and will be removed in React v16.0. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class v15.* is available on npm as a temporary, drop-in replacement. For more info see https://fb.me/react-create-class
=> Started your app.                          

=> App running at: http://localhost:3000/     
^C                                              
eric-burel@ericburel-ThinkPad-T450s:~/Websites/Vulcan-Starter$ ^C
eric-burel@ericburel-ThinkPad-T450s:~/Websites/Vulcan-Starter$ meteor run android
[[[[[ ~/Websites/Vulcan-Starter ]]]]]         

=> Started proxy.                             
=> Started MongoDB.                           
W20180104-12:05:29.341(1)? (STDERR) Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in  React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs
W20180104-12:05:29.380(1)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20180104-12:05:29.382(1)? (STDERR) While this implementation will work correctly, it is known to be
W20180104-12:05:29.382(1)? (STDERR) approximately three times slower than the native implementation.
W20180104-12:05:29.383(1)? (STDERR) In order to use the native implementation instead, run
W20180104-12:05:29.383(1)? (STDERR)           
W20180104-12:05:29.383(1)? (STDERR)   meteor npm install --save bcrypt
W20180104-12:05:29.384(1)? (STDERR)           
W20180104-12:05:29.384(1)? (STDERR) in the root directory of your application.
W20180104-12:05:29.405(1)? (STDERR) Warning: Accessing createClass via the main React package is deprecated, and will be removed in React v16.0. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class v15.* is available on npm as a temporary, drop-in replacement. For more info see https://fb.me/react-create-class
=> Started your app.                          

=> App running at: http://localhost:3000/     
=> Started app on Android Emulator.           
I20180104-12:06:39.579(1)? 01-04 12:06:21.798  5859  5859 I CordovaLog: Changing log level to DEBUG(3)
I20180104-12:06:39.580(1)? 01-04 12:06:22.654  5859  5859 I chromium: [INFO:library_loader_hooks.cc(120)] Chromium logging enabled: level = 0, default verbosity = 0
I20180104-12:06:39.580(1)? 01-04 12:06:24.856  5859  5859 W chromium: [WARNING:resource_bundle.cc(285)] locale_file_path.empty()
I20180104-12:06:39.581(1)? 01-04 12:06:27.335  5859  5955 W chromium: [WARNING:data_reduction_proxy_config.cc(423)] SPDY proxy OFF at startup
I20180104-12:06:39.581(1)? 01-04 12:06:28.960  5859  5859 I MeteorWebApp: Serving asset bundle with version: 9865cc20ad63985d95181edcb552860d3937e013
I20180104-12:06:39.581(1)? 01-04 12:06:34.684  5859  5859 I chromium: [INFO:CONSOLE(89586)] "Uncaught SyntaxError: Unexpected token )", source: http://localhost:12664/packages/modules.js?hash=09679b80e8c2f244d272de0bca5a8aec3a9db97b (89586)
I20180104-12:06:39.581(1)? 01-04 12:06:34.720  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/promise.js?hash=517cd99555a2024b690df6990ea22045db8e7b6b (17)
I20180104-12:06:39.581(1)? 01-04 12:06:34.738  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/babel-runtime.js?hash=51d95410a7ed2856f004a10426b3fad2c0d2f2da (17)
I20180104-12:06:39.581(1)? 01-04 12:06:34.739  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/ecmascript-runtime-client.js?hash=236033036aa3b0629009d2af14113e2413052567 (17)
I20180104-12:06:39.582(1)? 01-04 12:06:34.739  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/buffer.js?hash=90d2bd0b9dd3793ee7fc97eb7c1005409a796a13 (17)
I20180104-12:06:39.582(1)? 01-04 12:06:34.842  5859  5859 I chromium: [INFO:CONSOLE(18)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/ejson.js?hash=3af8c8d41c63ca01c1c9698a677bc5ae971ff3b2 (18)
I20180104-12:06:39.582(1)? 01-04 12:06:34.842  5859  5859 I chromium: [INFO:CONSOLE(18)] "Uncaught TypeError: Cannot read property 'EJSON' of undefined", source: http://localhost:12664/packages/diff-sequence.js?hash=15014d7b1e11c05111a386992e684ab1d3cc4158 (18)
I20180104-12:06:39.582(1)? 01-04 12:06:34.868  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/geojson-utils.js?hash=e9d235fa7a29b6bcb50d7ad0b05751fa169fcc8b (17)
I20180104-12:06:39.582(1)? 01-04 12:06:34.892  5859  5859 I chromium: [INFO:CONSOLE(18)] "Uncaught TypeError: Cannot read property 'EJSON' of undefined", source: http://localhost:12664/packages/id-map.js?hash=c7aea8dfa2bf46ff2ae0aa6c6cf09e36abc61d07 (18)
I20180104-12:06:39.582(1)? 01-04 12:06:34.892  5859  5859 I chromium: [INFO:CONSOLE(18)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/random.js?hash=189ef930765405ef87a31a621407fc34447b8756 (18)
I20180104-12:06:39.583(1)? 01-04 12:06:34.933  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'EJSON' of undefined", source: http://localhost:12664/packages/mongo-id.js?hash=345d169d517353f8146292b4abd24061721f8b26 (17)
I20180104-12:06:39.583(1)? 01-04 12:06:34.994  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'DiffSequence' of undefined", source: http://localhost:12664/packages/minimongo.js?hash=2b34314db9dbc6027d9d414887b75281c4515a19 (17)
I20180104-12:06:39.583(1)? 01-04 12:06:35.023  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/check.js?hash=eab389b8683d2f0b47a9d511894c2082fc6155a9 (17)
I20180104-12:06:39.583(1)? 01-04 12:06:35.079  5859  5859 I chromium: [INFO:CONSOLE(18)] "Uncaught TypeError: Cannot read property 'Random' of undefined", source: http://localhost:12664/packages/retry.js?hash=1e409617b538ff3e2b0238b15e45b3380c51a224 (18)
I20180104-12:06:39.583(1)? 01-04 12:06:35.101  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'check' of undefined", source: http://localhost:12664/packages/ddp-common.js?hash=83c6dba3051ec76b5c1cd85d39357f0f501add98 (17)
I20180104-12:06:39.583(1)? 01-04 12:06:35.102  5859  5859 I chromium: [INFO:CONSOLE(18)] "Uncaught TypeError: Cannot read property 'Symbol' of undefined", source: http://localhost:12664/packages/reload.js?hash=02487cd11db41d01f7837ad146e4680a9e8d2e12 (18)
I20180104-12:06:39.583(1)? 01-04 12:06:35.224  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'check' of undefined", source: http://localhost:12664/packages/ddp-client.js?hash=df770fd9a6a02fd730939b97d266ea2b12938e95 (17)
I20180104-12:06:39.584(1)? 01-04 12:06:35.227  5859  5859 I chromium: [INFO:CONSOLE(14)] "Uncaught TypeError: Cannot read property 'DDP' of undefined", source: http://localhost:12664/packages/ddp.js?hash=25dc3f428447c81620c91c4245dbc6e4f7d32fb7 (14)
I20180104-12:06:39.584(1)? 01-04 12:06:35.284  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'LocalCollection' of undefined", source: http://localhost:12664/packages/allow-deny.js?hash=74d8af62e9bac0bd3c45b254bad987e996a88f6e (17)
I20180104-12:06:39.584(1)? 01-04 12:06:35.322  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'AllowDeny' of undefined", source: http://localhost:12664/packages/mongo.js?hash=337de4ed4979262aa9b84177742e90e72b1e1e1c (17)
I20180104-12:06:39.584(1)? 01-04 12:06:35.338  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Random' of undefined", source: http://localhost:12664/packages/localstorage.js?hash=b8f7913d89016e62d42164380fabfc1366797d36 (17)
I20180104-12:06:39.585(1)? 01-04 12:06:35.394  5859  5859 I chromium: [INFO:CONSOLE(20)] "Uncaught TypeError: Cannot read property 'Random' of undefined", source: http://localhost:12664/packages/accounts-base.js?hash=423b90939b60dbd1dae8e5e8dd41b61ba2df4e29 (20)
I20180104-12:06:39.585(1)? 01-04 12:06:35.423  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Accounts' of undefined", source: http://localhost:12664/packages/service-configuration.js?hash=42ac9ae8eb44f3e73762f9cb0003410397021984 (17)
I20180104-12:06:39.585(1)? 01-04 12:06:35.482  5859  5859 I chromium: [INFO:CONSOLE(19)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/http.js?hash=2a49a01ff4226b3a07f1eadf69667c3217d481ea (19)
I20180104-12:06:39.586(1)? 01-04 12:06:35.573  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'EJSON' of undefined", source: http://localhost:12664/packages/meteorhacks_inject-initial.js?hash=d8851255936831bc3b8576d440d553dff6393dd3 (17)
I20180104-12:06:39.586(1)? 01-04 12:06:35.574  5859  5859 I chromium: [INFO:CONSOLE(18)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/webapp.js?hash=e448c6ebb2384292f7c97e676471a51951a04169 (18)
I20180104-12:06:39.586(1)? 01-04 12:06:35.574  5859  5859 I chromium: [INFO:CONSOLE(14)] "Uncaught TypeError: Cannot read property 'DDP' of undefined", source: http://localhost:12664/packages/livedata.js?hash=7cf1831a60b48e304b054aee1ae0f7e38ff35d09 (14)
I20180104-12:06:39.586(1)? 01-04 12:06:35.614  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'meteorInstall' of undefined", source: http://localhost:12664/packages/dynamic-import.js?hash=d20b3dfd7dd31096c4c95f8751141e932cabc923 (17)
I20180104-12:06:39.586(1)? 01-04 12:06:35.630  5859  5859 I chromium: [INFO:CONSOLE(19)] "Uncaught TypeError: Cannot read property 'Retry' of undefined", source: http://localhost:12664/packages/autoupdate.js?hash=cdfb6b94a347d718a41c216182b9aac5f2910d08 (19)
I20180104-12:06:39.587(1)? 01-04 12:06:35.707  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Mongo' of undefined", source: http://localhost:12664/packages/vulcan_lib.js?hash=056a08624547373840957522ecd5591f6d94984d (17)
I20180104-12:06:39.587(1)? 01-04 12:06:35.778  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/vulcan_i18n.js?hash=b8fc764afe45ea988557135ee90f32db2075efda (17)
I20180104-12:06:39.587(1)? 01-04 12:06:35.802  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/vulcan_users.js?hash=348a72f8fed53987583f8622e7e0c32387aa0ee7 (17)
I20180104-12:06:39.587(1)? 01-04 12:06:35.802  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/vulcan_routing.js?hash=5870b9ef7a4d4dec9907dec0153b259b67e2c3be (17)
I20180104-12:06:39.587(1)? 01-04 12:06:35.860  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/vulcan_email.js?hash=e666a04c550729cb15690c0363c7b3d40f8401c8 (17)
I20180104-12:06:39.587(1)? 01-04 12:06:35.884  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/vulcan_debug.js?hash=1d0c9135302d2bc9c20c9e46d2b67de7bb646704 (17)
I20180104-12:06:39.588(1)? 01-04 12:06:35.989  5859  5859 I chromium: [INFO:CONSOLE(1223)] "deviceready has not fired after 5 seconds.", source: http://localhost:12664/cordova.js (1223)
I20180104-12:06:39.588(1)? 01-04 12:06:35.989  5859  5859 I chromium: [INFO:CONSOLE(1216)] "Channel not fired: onDOMContentLoaded", source: http://localhost:12664/cordova.js (1216)
I20180104-12:06:39.588(1)? 01-04 12:06:36.013  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/vulcan_core.js?hash=f4f1f93e3efb09a8c6d4acdd48b7be34068096fd (17)
I20180104-12:06:39.588(1)? 01-04 12:06:36.091  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/vulcan_i18n-en-us.js?hash=61ae386c4759e9c0c3b60885f20e0acd6d2bdee6 (17)
I20180104-12:06:39.588(1)? 01-04 12:06:36.180  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Random' of undefined", source: http://localhost:12664/packages/srp.js?hash=85fa5b3bc1440273f8fa5125df5443c09f337567 (17)
I20180104-12:06:39.588(1)? 01-04 12:06:36.193  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Accounts' of undefined", source: http://localhost:12664/packages/accounts-password.js?hash=82882a16a9f1ac3f2f525c18941bfabd9ff99cc2 (17)
I20180104-12:06:39.588(1)? 01-04 12:06:36.265  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/vulcan_forms.js?hash=bd2fc1884884b705ca4046c224ce885bef409aa4 (17)
I20180104-12:06:39.589(1)? 01-04 12:06:36.265  5859  5859 I chromium: [INFO:CONSOLE(20)] "Uncaught TypeError: Cannot read property 'EJSON' of undefined", source: http://localhost:12664/packages/reactive-dict.js?hash=36dba3ca2e22f021d4d49ea7a60e99b03349a689 (20)
I20180104-12:06:39.589(1)? 01-04 12:06:36.299  5859  5859 I chromium: [INFO:CONSOLE(18)] "Uncaught TypeError: Cannot read property 'ReactiveDict' of undefined", source: http://localhost:12664/packages/session.js?hash=821b0746e602b3be69538d299d6866e222121b54 (18)
I20180104-12:06:39.589(1)? 01-04 12:06:36.487  5859  5859 I chromium: [INFO:CONSOLE(20)] "Uncaught TypeError: Cannot read property 'Accounts' of undefined", source: http://localhost:12664/packages/vulcan_accounts.js?hash=52a620a758f06916ecfd9340990c033b66787e93 (20)
I20180104-12:06:39.590(1)? 01-04 12:06:36.508  5859  5859 I chromium: [INFO:CONSOLE(17)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/example-simple.js?hash=09efec996b23a6472325264a886b0fe583fc745c (17)
I20180104-12:06:39.590(1)? 01-04 12:06:36.508  5859  5859 I chromium: [INFO:CONSOLE(3)] "Uncaught TypeError: Cannot read property 'Vulcan' of undefined", source: http://localhost:12664/packages/global-imports.js?hash=2383c9b5be495341739543bcfef0a2922deaf1ff (3)
eric-burel commented 6 years ago

Sounds like an issue with ES6, the faulty unexpected ) belongs to a fat arrow const proto = Object.defineProperties(() => {}, styles); I am using Android API 23, on more recent version the error is different, I have a use of const in strict mode.

So I guess that there is some code that is'nt transpiled, somewhere, and it breaks on old mobiles.

Edit: it seems that the chalk module is'nt transpiled.
Edit 2: here you go, sanitize-html is responsible for loading the 2.2.3 version of chalk in the frontend, however chalk is'nt transpiled anymore (make sense since it is a pure backend module). I opened an issue on sanitize-html, but maybe this will require using a fork in Vulcan while it is open. https://github.com/punkave/sanitize-html/issues/195 https://github.com/postcss/postcss/issues/1060

Edit 3: Removing chalk from sanitize-html indeed fixes the issue :)

SachaG commented 6 years ago

Oh wow, glad you could track it down.

eric-burel commented 6 years ago

Hi, however to be fully solved I think that we need to figure out where postcss or sanitize-html are used in the Starter template, because there may be a misuse. Those are not frontend package, so they shouldn't have ended up in the front in the first place (I guess?). Do you have an idea where those lib could be imported?

SachaG commented 6 years ago

sanitize-html is used here:

https://github.com/VulcanJS/Vulcan/blob/master/packages/vulcan-lib/lib/modules/utils.js#L206-L222

This file is imported on the client, too, but we could extract Utils.sanitize to be only defined on the server. It'll be a bit hacky because Utils will have different contents on client and server, but it's not a big deal.

SachaG commented 6 years ago

Oh and I don't know about postcss…?

ochicf commented 6 years ago

Hi there!

I've been experiencing some issues with older browsers (specially IE) and I tracked the error down to the package chalk being bundled to the client. It seems that this is the very same problem, so I've created a PR to address it.

I've not been able to fully test it yet, so could you review it and see if it fixes the issue with Cordova aswell?

Btw, thanks @eric-burel for tracking the package dependency that caused chalk being bundled to the client!

eric-burel commented 6 years ago

You're welcome and thanks for the PR, I had similar issue like a thousand time when using Electron, messed up client/server import is a classic of isomorphic js apps.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.