Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Update this solution describes how to effectively use the new Npm system in Meteor.


What is the current method of using NPM packages in Meteor?

As of March 22, 2013, there is no official documentation on this.

There are several questions about this, notably this one, however the solution seems outdated: the engine branch no longer exists, and I haven't been able to find anything on Npm.require in Meteor.

Another solution, posted here, instructs to install into the .meteor/ build folders. As I am installing to Heroku, this doesn't seem like a valid solution, as the buildpack uses meteor bundle to bundle the program before running it. Thus, the temporary build folders don't seem like a valid option.

What has happened to Npm in meteor? What's the latest way of using Npm packages?

On a related note, I'm trying to use the Amazon SDK (for s3) - would it be better to just package it as a Meteorite package instead?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
293 views
Welcome To Ask or Share your Answers For Others

1 Answer

Arunoda has created an NPM Atmosphere package that allows you to use any NPM module like you're used to. It's very simple.

First, mrt add npm.

You can also install the package by using meteor-npm command from npm install -g meteor-npm.

Next, make a packages.json file in your root project directory, with the package names and versions:

{
    "foobar": "0.3.5",
    "loremipsum": "2.1.4"
}

Finally, use them with Meteor.require, like this: var FooBar = Meteor.require('foobar');


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...