Adding packages to a Meteor.js application

The first of many…. many Meteor.js mini-posts as I make sense of their documentation (or lack thereof?).

Create a top-level directory named packages
Create a directory for the npm module you want to install. For example, if you want to use connect, the directory would be /packages/connect.
Create a file named package.js in your npm module directory (e.g. /packages/connect/package.js).
Put the name of the npm module, the version you want in the following format.

1
2
3

Npm.depends({
“connect”: “2.7.10”
});

Then, in order to use that library, you don’t use the standard node.js require(‘connect’) statement, but rather the wrapping Npm.require(‘connect’) statement.

Leave a Reply