I am going through the Discover Meteor book and have come to the part of adding Iron Router.
I have used the $ meteor add iron:router and am now running the latest versions of meteor (1.1.0.2) and iron router (1.0.7). The microscope app being worked on still crashes giving the following errors:
The connection to ws://localhost:3000/sockjs/057/8aq0hvee/websocket was interrupted while the page was loading. ddp.js:1344:0
TypeError: Template.__create__ is not a function iron-dynamic-template.js:416:37
TypeError: Parent is undefined meteor.js:225:4
TypeError: Iron.Layout is not a constructor iron-router.js:1475:19
Error: There are multiple templates named '__IronDefaultLayout__'. Each template needs a unique name. templating.js:59:0
TypeError: Layout is not a constructor iron_router.js:1617:17
TypeError: Package['iron:router'] is undefined global-imports.js:3:0
ReferenceError: Template is not defined template.layout.js:2:0
ReferenceError: Template is not defined template.post_item.js:2:0
ReferenceError: Template is not defined template.posts_list.js:2:0
ReferenceError: Router is not defined router.js:1:12
ReferenceError: Template is not defined post_item.js:1:12
ReferenceError: Template is not defined posts_list.js:1:12
ReferenceError: Router is not defined router.js:1:12
ReferenceError: Meteor is not defined posts.js:1:12
ReferenceError: Meteor is not defined main.js:1:12
Most posts for something like this say I need to use the meteor add iron:router instead of mrt add iron:router, however even after doing so, the app still keeps crashing.
Related
I'm trying to use Google Cloud Text-to-Speech API in Meteor app, but get an error on the Meteor console and crash when trying to use the import function described in the instructions:
("Uncaught TypeError: Cannot convert undefined or null to object at Function.getPrototypeOf (<anonymous>)")
Here's what I've done (in app directory) before starting meteor:
meteor npm install google-tts-api
export GOOGLE_APPLICATION_CREDENTIALS="/data/authenticationinfo.json"
The problems are related to the inclusion of this line at the top of my js file:
import textToSpeech from '#google-cloud/text-to-speech';
This line cause the following Meteor startup error on the console:
"Unable to resolve some modules: "http2" in /app/node_modules/#grpc/grpc-js/build/src/channel.js (web.browser)
If you notice problems related to these missing modules, consider running:
meteor npm install --save meteor-node-stubs
Actually, I ran the above command, but it has no effect. When I run start the app, it crashes quickly with the error :
Uncaught TypeError: Cannot convert undefined or null to object
at Function.getPrototypeOf ()
at module.exports (modules.js?hash=59a3378abff937a73bf3a9865d654fce71b9583a:91277)
at index.js (modules.js?hash=59a3378abff937a73bf3a9865d654fce71b9583a:86991)
at fileEvaluate (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:346)
at Module.require (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:248)
at require (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:268)
at jwtclient.js (modules.js?hash=59a3378abff937a73bf3a9865d654fce71b9583a:79821)
at fileEvaluate (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:346)
at Module.require (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:248)
at require (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:268)
I have tested it on a barebones node app, and my Google authentication json file works fine, so that's definitely not the problem.
I realize there are are some Meteor packages for Google TTS, but they're really old and use Google Translate (which won't work for long) instead of the new cloud services.
So, it turns out the import has to happen on the server side, NOT the client side.
I am trying to login Facebook with Firebase. I have installed all the libraries required and completed the required configuration. Still, whenever I try to start my app it is giving me this error:
(node:11160) UnhandledPromiseRejectionWarning: TypeError: Cannot read
property 'manifest' of undefined
at removeOldOptions (C:\Users\Dell\Desktop\firebaseapp\plugins\cordova- universal-links-plugin\hooks\lib\android\manifestWriter.js:48:32)ished in 37.33 s
at Object.writePreferences
(C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links-
plugin\hooks\lib\android\manifestWriter.js:27:19)
at activateUniversalLinksInAndroid
(C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:65:25)
at C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:45:11
at Array.forEach (<anonymous>)
at run (C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:41:17)
at module.exports (C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:18:3)
at runScriptViaModuleLoader (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:188:18)
at runScript (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:164:16)
(node:11160) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
Able to solve this with below changes :
Just go to the below file in Ionic
plugins/cordova-universal-links-plugin/hooks/lib/android/manifestWriter.js
I fixed issue by changing pathToManifest as below:
var pathToManifest = path.join(cordovaContext.opts.projectRoot, 'platforms', 'android', 'cordovaLib', 'AndroidManifest.xml');
to
var pathToManifest = path.join(
cordovaContext.opts.projectRoot,
'platforms',
'android',
'app',
'src',
'main',
'AndroidManifest.xml');
For anyone that's looking into this these days, the actual fix for this was published by someone which you can pull in as a cordova plugin https://github.com/nordnet/cordova-universal-links-plugin/issues/133#issuecomment-369260863
#okaufmann you can use the changed version of the plugin. since it's not merged in the nordnet repository, you must remove the plugin and install again using:
cordova plugin add https://github.com/walteram/cordova-universal-links-plugin
After doing...
cordova plugin rm cordova-universal-links-plugin
cordova plugin add https://github.com/walteram/cordova-universal-links-plugin
.. my project was able to build successfully.
You need to update the AndroidManifest path in the plugin, which seems to be outdated. Check out this:
https://github.com/nordnet/cordova-universal-links-plugin/issues/146
So I've done the todo and leaderboard tutorials and now am excited to begin routing - seems like iron router is the way to go so I install it to my project using
mrt add iron-router
Seems to install ok so I start meteor and navigate to localhost:3000 and my console lights up with:
Uncaught TypeError: undefined is not a function
helpers.js:141 Uncaught TypeError: Cannot read property 'prototype' of undefined
router.js:61 Uncaught TypeError: undefined is not a function
global-imports.js?784bc180a149e4c10dff977a7f114df67d9952c6:3 Uncaught TypeError: Cannot read property 'RouteController' of undefined
template.tutorialexample.js?e119ff8df948cfe8167f49eb28794995a594841c:2 Uncaught ReferenceError: Template is not defined
tutorialexample.js?a4ef596255404350be2cc45303caea02f934cd17:1 Uncaught ReferenceError: Meteor is not defined
Mind you this is a default app, haven't touched a thing.
So if someone could point me in the right direction that would be great. I did read somewhere that I should be using 0.8.2 version of iron router - and I then did change my smart.json file to contain:
{
"packages": {
"iron-router": "0.8.2"
}
}
and then did meteor update etc but still no luck. So any help anyone could provide would be great.
Meteor has changed quite a bit & the instructions/tutorial you've been following is a bit dated.
Previously mrt was part of the meteorite packaging system, from Meteor 0.9.0 it has been integrated directly into meteor.
So now you do:
meteor add iron:router
To add it to your project. Once you start your app up it should present a basic template on how to use it.
I'm trying to get the Firebase authentication/sync running in the "Topeka" Polymer-sample.
This is what I've done:
Checked out topeka-master from GitHub
Ran bower install
Created a new Firebase-account and added the FirebaseIO-URL of the newly created project to topeka-datasource.html and topeka-leaderboard.html
Enabled anonymous auth in the Firebase project
Everything works fine if I use the .../?test-flag (which doesn't use Firebase)
Without the flag, I'm getting the following exceptions in Firefox (33.0.3):
Exception caught during observer callback: .locationChanged#data:text/javascript;charset=utf-8,%0A%20%20%0A%20%20Polymer('firebase-login'%2C%20%7B%0A%0A%20%20%20%20%2F**%0A%20%20%20%20%20*%20Fired%20when%20user%20is%20logged%20in%0A%20%20%20%20%20*%20%0A%20%20%20%20%20*%20%40event%20login%0A%20%20%20%20%20*%2F%0A%0A%20%20%20%20%2F**%0A%20%20%20%20%20*%20Fired%20when%20user%20is%20logged%20out%0A%20%20%20%20%20*%20%0A%20%20%20%20%20*%20%40event%20logout%0A%20%20%20%20%20*%2F%0A%0A%20%20%20%20%2F**%0A%20%20%20%20%20*%20Fired%20when%20an%20error%20occurred%20logging%20in%0A%20%20%20%20%20*%20%0A%20%20%20%20%20*%20%40event%20error%0A%20%20%20%20%20*%2F%0A%0A%20%20%20%20%2F**%0A%20%20%20%20%20*%20Fired%20when%20user%20is%20created%20(password%20provider%20type)%0A%20%20%20%20%20*%20%0A%20%20%20%20%20*%20%40event%20user-created%0A%20%20%20%20%20*%2F%0A%0A%20%20%20%20%2F**%0A%20%20%20%20%20*%20Fired%20when%20user%20changes%20their%20password%20(password%20provider%20type)%0A%20%20%20%20%20*%2"[…] observe.js:753
TypeError: this.ref.onAuth is not a function data:%0A%20%20%0A%20%20Polymer('firebase-login'%2C%20%7B%0A%0A%20%20%20%20%2F**%0A%20%20%20%20%20*%20Fired%20when%20user%20is%20logged%20in%0A%20%20%20%20%20*%20%0A%20%20%20%20%20*%20%40event%20login%0A%20%20%20%20%20*%2F%0A%0A%20%20%20%20%2F**%0A%20%20%20%20%20*%20Fired%20when%20user%20is%20logged%20out%0A%20%20%20%20%20*%20%0A%20%20%20%20%20*%20%40event%20logout%0A%20%20%20%20%20*%2F%0A%0A%20%20%20%20%2F**%0A%20%20%20%20%20*%20Fired%20when%20an%2[...]components%2Ffirebase-element%2Ffirebase-login.html.js%0A:142
And in Chrome (40.0.2209.0 dev-m):
Exception caught during observer callback: TypeError: undefined is not a function
at firebase-login.Polymer.locationChanged (http://www.sample.com/mysubdir/components/firebase-element/firebase-login.html:164:18)
at firebase-login.properties.invokeMethod (http://www.sample.com/mysubdir/components/polymer/src/instance/properties.js:114:12)
at firebase-login.properties.notifyPropertyChanges (http://www.sample.com/mysubdir/components/polymer/src/instance/properties.js:103:20)
at Object.Observer.report_ (http://www.sample.com/mysubdir/components/observe-js/src/observe.js:750:24)
at Object.createObject.check_ (http://www.sample.com/mysubdir/components/observe-js/src/observe.js:1156:12)
at callback (http://www.sample.com/mysubdir/components/observe-js/src/observe.js:648:20)
I’ve had some serious problems after updating meteor to 0.9.1.
Here are some example errors from the console.
Uncaught TypeError: undefined is not a function -- in dynamic_template.js
Uncaught TypeError: Cannot read property ‘prototype’ of undefined -- in helpers.js
Uncaught TypeError: undefined is not a function -- in router.js
Uncaught TypeError: Cannot read property ‘RouteController’ of undefined -- in iron-router-progress.js
Uncaught TypeError: Cannot read property ‘RouteController’ of undefined -- in global-imports.js
And dozens of: Uncaught ReferenceError: Template is not defined -- in client view js files, both the hard copies that I have created and the apparently ephemeral files that meteor apparently creates on the fly.
And fewer dozens of: Uncaught ReferenceError: Meteor is not defined -- in the same kind of files.
And one: Uncaught ReferenceError: Spacebars is not defined -- in login_buttons_dialogs.html
And about 10 sockjs errors on GET — net:ERR_CONNECTION_REFUSED
I can’t help thinking that either something very basic was not accomplished during the update procedure or there are some very basic and widespread changes that need to be made in my code in order for it to run 0.9.1.
I’m building a app that is an extension and morph of the microscope app. It's not rocket science at this point. It was working last night before the update. It was 0.9.0.1 before the update.
All help and insight is appreciated.
Thanks for the guidance. All seems to be well now. This is what I did:
I created a new meteor app, removed 2 default packages, then added:
bootstrap
iron:router
mrt:accounts-ui-bootstrap-dropdown
accounts-password
mrt:iron-router-progress
sacha:spin
Then I copied my files from the broken app to the new app and viola', everything worked.
I see that the directory structure and its naming conventions have changed, colons in place of dashes in a few spaces and the direcory or namespace prefixes such as mrt, iron, and sacha.
Here's an unexpected thing. I previously had a folder called packages in which there was a folder for each package containing all its files. Now that folder is empty, but everything is still working. I'm clearly under informed about a few things.
Again, thanks for the guidance. Even though this was a pain, I see that the resulting changes needed to happen.
Best, Alex
Many packages are breaking on Meteor#0.9.1, I suggest you create a new Meteor app like so:
$ meteor create --release 0.9.0 app
$ cd app
$ meteor remove insecure
$ meteor remove autopublish
and then add all the packages you need with meteor add packagename and copy over all the files from your app.
Stick with Meteor#0.9.0 until you know you can safely upgrade!