With a brand new windows installation of Meteor and the simplest of packages, I am getting
ReferenceError: AccountsTemplates is not defined
I am attempting to use the postSignUpHook feature, like so
(tried in the base directory as well as /server/)
AccountsTemplates.configure({
postSignUpHook: myPostSubmitFunc
});
var myPostSubmitFunc = function(userId, info) {
console.log("new user " + userId);
}
Here is the versions that have been installed using meteor install
meteor list
accounts-base 1.2.2 A user account system
accounts-password 1.1.4 Password support for accounts
accounts-ui 1.1.6 Simple templates to add login widgets to an app
alanning:roles 1.2.15 Authorization package for Meteor
blaze-html-templates 1.0.1 Compile HTML templates into reactive UI with
Meteor Blaze
ecmascript 0.1.6* Compiler plugin that supports ES2015+ in all
.js files
es5-shim 4.1.14 Shims and polyfills to improve ECMAScript 5
support
insecure 1.0.4 (For prototyping only) Allow all database
writes from the client
jquery 1.11.4 Manipulate the DOM using CSS selectors
meteor-base 1.0.1 Packages that every Meteor app needs
mobile-experience 1.0.1 Packages for a great mobile user experience
mongo 1.1.3 Adaptor for using MongoDB and Minimongo over
DDP
session 1.1.1 Session variable
standard-minifiers 1.0.2 Standard minifiers used with Meteor apps by
default.
tracker 1.0.9 Dependency tracker to allow reactive callbacks
From what I can tell AccountsTemplates is suppose to come from accounts-base, but I am having a hard time actually finding where it is created.
Also If i remember correctly, when you get missing reference errors like this it could be a problem with an incompatible package somewhere else unrelated? How do I go about debugging whats going on here?
I guess I was confused because guide.meteor.com is assuming the use of useraccounts:flow-routing.
What I should be looking at is docs.meteor.com, in the accounts section.
Specifically I guess I will use Accounts.onLogin to add roles after a new user is created. I can not use AccountsServer#onCreateUser since the userId is not generated yet at that point.
(The docs.meteor.com actually has a seemingly erroneous AccountsCommon#onLogin, watch out for that, that method does not exist on AccountsServer)
Related
I'm implementing custom user authentication in a Meteor application (so no use of accounts-ui). I have only done 'meteor add accounts-password' and registration/login are working as expected. In lots of tutorials, I also read they are doing a 'meteor add accounts-base' which is something I didn't do specifically, yet it is working.
Why would I need 'accounts-base'? For what functionality?
accounts-base is a dependency of accounts-password, so it's alteady included in your application, there's no need to add it separately. It provides the basic account concepts (Meteor.users collection, for instance) that accounts-password relied on.
I am trying to update to Meteor 1.2.
But when I run Meteor update, it starts to run and get to
Downloading 8 packages -
And the spinner stops and its been like this for 20 minutes or so.
Ive tried quitting the process and starting it up again, and the same result.
Any suggestions on what I can try? The server seems to still start ok, but I cannot update
Here is the package list
3stack:accounts-password-hook 0.0.2 Overwrites Accounts.createUser to provide an afterCreateUser hook
abpetkov:switchery 0.1.0 Switchery (official) - turns your default HTML checkbox inputs into beautiful iOS 7 style swi...
accounts-password 1.1.1* Password support for accounts
alanning:roles 1.2.13 Role-based authorization
aldeed:autoform 5.3.2* Easily create forms with automatic insert and update, and automatic reactive validation.
aldeed:collection2 2.3.3* Automatic validation of insert and update operations on the client and server.
aldeed:simple-schema 1.3.3 A simple schema validation object with reactivity. Used by collection2 and autoform.
aramk:rrule 2.1.0 JavaScript library for working with recurrence rules for calendar dates.
babrahams:transactions 0.6.21* Undo/Redo stack based on transactions
benmgreene:moment-range 1.0.7 Fancy date ranges for Moment.js packaged for Meteor.
cmather:handlebars-server 2.0.0 Allows handlebars templates to be defined on the server in .handlebars files
coffeescript 1.0.6* Javascript dialect with fewer braces and semicolons
cunneen:mailgun 0.9.1 Easily send emails using Mailgun as your email provider.
cunneen:sendgrid 0.9.0 Easily send emails using Sendgrid your email provider.
czbaker:apac 0.0.3 Access to the Amazon Product Advertising API, using the NodeJS 'apac' module.
czbaker:lightbox2 2.7.1_1 Provides the Lightbox2 JS library for Meteor.
dhtmlx:scheduler 0.0.2 dhtmlxScheduler is an event calendar that allows adding a Google-like scheduler on a web page.
edgee:slingshot 0.7.1 Directly post files to cloud storage services, such as AWS-S3.
email 1.0.6* Send email messages
francocatena:status 1.3.0* Display the connection status between the browser and the Meteor server
gilbertwat:bootstrap3-daterangepicker 1.3.21_1 Date range picker component for Twitter Bootstrap 3
houston:admin 2.0.3* A zero-config Meteor Admin
ian:accounts-ui-bootstrap-3 1.2.59+ Bootstrap-styled accounts-ui with multi-language support.
iron:router 1.0.9 Routing specifically designed for Meteor
jonblum:jquery-cropper 0.10.1* Fengyuan Chen's terrific jQuery plugin for cropping/zooming/rotating images, packaged for Me...
juliancwirko:s-alert 2.4.1* Simple and fancy notifications / alerts / errors for Meteor
juliancwirko:s-alert-slide 1.1.3* Slide effect for s-alert - simple and fancy notifications / alerts for Meteor.
kadira:debug 2.1.0* Full Stack Debugging Solution for Meteor
kevohagan:sweetalert 0.5.0* a beautiful replacement for javascript's alert()
meteor-platform 1.2.2* Include a standard set of Meteor packages in your app
meteorhacks:cluster 1.6.9 Clustering solution for Meteor with load balancing and service discovery.
meteorhacks:kadira 2.22.0* Performance Monitoring for Meteor
meteorhacks:npm 1.5.0 Use npm modules with your Meteor App
meteorhacks:ssr 2.1.2 Server Side Rendering for Meteor with Blaze
meteortoys:allthings 1.2.1* Insanely Handy Development Tools for Meteor
mquandalle:jade 0.4.3* Jade template language
mrt:accounts-admin-ui-bootstrap-3 0.2.7+ A roles based account management system using bootstrap 3
mrt:cron 0.0.1 Simple meteor.cron
mrt:jquery-masonry 0.1.0 jQuery Masonry repackaged for Meteor
mrt:moment 2.8.1 Moment.js, a JavaScript date library for dates, packaged for Meteor. See http://momentjs.com.
mrt:moment-timezone 0.2.1 Timezone support for moment.js, packaged for Meteor. See http://momentjs.com/timezone.
multiply:iron-router-progress 1.0.1* Progressbar for iron:router
natestrauser:font-awesome 4.3.0* Latest version Font-Awesome loaded via CDN
natestrauser:select2 3.5.1* Select2 is a jQuery based replacement for select boxes.
npm-container 1.2.0+ Contains all your npm dependencies
praxie:canvas-to-blob 1.1.1 JavaScript Canvas to Blob is a function to convert canvas elements into Blob objects
random 1.0.3* Random number generator and utilities
rcy:nouislider 7.0.7_2 noUiSlider is a lightweight jQuery range slider plugin
reactive-var 1.0.5* Reactive variable
reywood:publish-composite 1.3.6* Publish a set of related documents from multiple collections with a reactive join
risul:bootstrap-colorpicker 2.2.0 Bootstrap Colorpicker: http://mjolnic.com/bootstrap-colorpicker/
sacha:spin 2.3.1 Simple spinner package for Meteor
skinnygeek1010:validate-form 0.3.0 A micro form validator
stylus 1.0.7* Expressive, dynamic, robust CSS
themeteorchef:bert 1.1.0 Client-side curmudgeon for Meteor.
tsega:bootstrap3-datetimepicker 4.14.30_4 Bootstrap 3 DateTime picker from #Eonasdan, packaged for Meteor.js
twbs:bootstrap 3.3.5 The most popular front-end framework for developing responsive, mobile first projects on the ...
woody:stripe-easy 0.1.0+ Subsciptions with Stripe made easy for Meteor.
yogiben:pretty-email 0.0.6 Send pretty emails
zimme:collection-timestampable 1.0.9 Add timestamps to collections
zimme:select2-bootstrap3-css 1.4.6 CSS to make Select2 fit in with Bootstrap 3
It works now. I just had to wait sometime. I think the meteor package server was down. So it was just waiting. If this happens to you just wait some time and try again.
I had the same problem (tried waiting or kill/re-running repeatedly) and I checked the status of the meteor package server, which was operational. However, after I ran "meteor list" something must have changed because "meteor update" ran fine. Could have been a coincidence but thought I'd share in case it solves the issue for someone else.
Is it possible to get a list of all available packages and their configuration within a running MeteorJS app.
I don't mean the CLI command meteor list but something that could let me check if certain packages are available or not and change the programs behaviour accordingly.
Yes.
Using code from the meteorhacks SSR package as an example, you can see that it does this to check for the existence of the Jade package:
if(Package['mquandalle:jade-compiler']) {
Compilers.jade = Package['mquandalle:jade-compiler'].JadeCompiler;
}
The caveat is that the other package has to be added first.
From the Meteor docs:
Give users of this package access to another package (by passing in the string packagename) or a collection of packages (by passing in an array of strings [packagename1, packagename2]).
I have no idea what it means.
From this question I know that imply can be employed with use.
What does api.imply do?
What's exactly the difference between api.use and api.imply?
api.use gives a package access to other packages exported symbols.
For example you need to api.use("random") (see how it's done in the accounts-base package) if you want to use the Random symbol in a package code (see how the random package.js is api.exporting Random).
However, meteor adding accounts-base wouldn't give your whole application access to its used packages (random in this case). If your app needs random, you'd still need to meteor add it.
api.imply on the other hand, gives the whole application access to that package exported symbols.
For example, see how accounts-google is api.implying accounts-base.
accounts-base is responsible for exporting the Accounts symbol, when you meteor add accounts-google, not only does accounts-base is also added in your application dependencies, but accounts-base symbols are also made available in your app, specifically because it was implied.
accounts-base is both using Accounts in its own code (api.use) and exporting its dependencies symbols to the whole app (api.imply).
api.imply can be used to make "shadow packages" that are just pulling in some other packages.
For example, at some point MDG renamed the showdown package to markdown, they could just have stated to meteor remove showdown && meteor add markdown, but it would have required some actions on end users.
What they did instead is keeping the showdown package and just make it implying the new markdown package.
If you have something in your app that consumes api from package:name and you install just package package:dependant which has a package:name as a dependency, but you don't use imply here, your api from package:name will not work in the app. It will work only in package:dependant package. You need use imply if you want to use something from package:name outside your package:dependant
I don't know if this is clear ;)
With the latest Meteor version 0.5.9 I've been experimenting with the appcache package, and really like its functionality.
I used meteor create --example leaderboard and then meteor add appcacheto test out the behaviour, and the page even loads when the server is not running at all! Super cool!
However, the database does not seem to be cached? When the server is not running
Players.find().fetch()
returns
[]
This is quite a showstopper for me, as I'm making a notes app where the notes need to be available offline as well. Am I missing something or is there an alternative method of getting database data when offline?
Look at the Ground:DB Package for this use. This package makes client side caches of subscribed collections.
https://atmospherejs.com/ground/db
Example of a collection that will get populated by Meteor subscriptions (subscribe call required separately)
localCollection = new Ground.Collection('mongoName');
Example of disconnected Collection (so you have to populate it yourself)
disconnectedCollection = new Ground.Collection('localName', {connection:null} );
The appcache package doesn't cache your data. See the docs:
The appcache package stores the static parts of a Meteor application (the client side Javascript, HTML, CSS, and images) in the browser's application cache.
[...]
(Note however that the appcache package by itself doesn't make data available offline: in an application loaded offline, a Meteor Collection will appear to be empty in the client until the Internet becomes available and the browser is able to establish a livedata connection).
At this point the appcache package is purely meant to improve loading speed of your app by caching static resources. See the meteor wiki:
The appcache package is only designed to cache static resources. As an "application" cache, it caches the resources needed by the application, including the HTML, CSS, Javascript and files published in the public/ directory.