How can I completely uninstall and then reinstall Meteor.js?

Let’s start with the deletions, then we’ll move on to the reinstallations. If you ever installed Meteorite, uninstall and delete it: sudo mrt uninstall sudo mrt uninstall –system rm -rf ~/.meteorite Then delete Meteor: sudo rm /usr/local/bin/meteor rm -rf ~/.meteor Now start over at the beginning: Repair permissions if necessary: sudo chown -R $(whoami) ~/.npm … Read more

Ordering of the css and js files loaded by Meteor

This question has since been answered in The JavaScript and CSS files in an application are loaded according to these rules: Files in the lib directory at the root of your application are loaded first. Files that match main.* are loaded after everything else. Files in subdirectories are loaded before files in parent directories, … Read more

Meteor: how to search for only distinct field values aka a collection.distinct(“fieldname”) similar to Mongo’s

You can just use underscore.js, which comes with Meteor – should be fine for the suggested use case. You might run into performance problems if you try this on a vast data set or run it repeatedly, but it should be adequate for common-or-garden usage: var distinctEntries = _.uniq(Collection.find({}, { sort: {myField: 1}, fields: {myField: … Read more

Meteor.methods returns undefined

This is a perfectly normal behavior: server method calls in Meteor are documented to be asynchronous : On the client, if you do not pass a callback and you are not inside a stub, call will return undefined, and you will have no way to get the return value of the method. It means that … Read more

How to build a Meteor smart package

Meteor now supports a create –package command. See the meteor docs. Example (substitute your own meteor developer account for “cunneen”): meteor create –package cunneen:foo Output: cunneen:foo: created in your app Results: packages/cunneen:foo/package.js Package.describe({ name: ‘cunneen:foo’, version: ‘0.0.1’, // Brief, one-line summary of the package. summary: ”, // URL to the Git repository containing the source … Read more

Callback after the DOM was updated in Meteor.js

A hacky way to do it is: foo.html <template name=”mytemplate”> <div id=”my-magic-div”> .. stuff goes here .. {{add_my_special_behavior}} </div> </template> foo.js Template.mytemplate.add_my_special_behavior = function () { Meteor.defer(function () { // find #my-magic-div in the DOM // do stuff to it }); // return nothing }; The function will get called whenever the template is rendered … Read more

Uncaught TypeError: fs.readFileSync is not a function

The following webpack.config.js is working for me. It incorporates @also’s good idea for the brfs matcher: var webpack = require(‘webpack’) var path = require(‘path’) module.exports = { entry: ‘./app.js’, output: { path: __dirname, filename: ‘bundle.js’ }, resolve: { extensions: [”, ‘.js’], alias: { webworkify: ‘webworkify-webpack’, ‘mapbox-gl’: path.resolve(‘./node_modules/mapbox-gl/dist/mapbox-gl.js’) } }, module: { loaders: [ { test: … Read more

Apollo / GraphQl – Type must be Input type

From the spec: Fields may accept arguments to configure their behavior. These inputs are often scalars or enums, but they sometimes need to represent more complex values. A GraphQL Input Object defines a set of input fields; the input fields are either scalars, enums, or other input objects. This allows arguments to accept arbitrarily complex … Read more