2013 Meteor NPM 包 [英] 2013 Meteor NPM Packages

查看:31
本文介绍了2013 Meteor NPM 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新此解决方案描述了如何在 Meteor 中有效地使用新的 Npm 系统.

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

目前在 Meteor 中使用 NPM 包的方法是什么?

截至 2013 年 3 月 22 日,没有这方面的官方文档.

对此有几个问题,特别是 这个,但是解决方案似乎已经过时:引擎分支不再存在,而且我在 Meteor 中的 Npm.require 上找不到任何内容.

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.

另一种解决方案,在此处发布,指示安装到 .meteor/代码> 构建文件夹.当我安装到 Heroku 时,这似乎不是一个有效的解决方案,因为 buildpack 在运行之前使用 meteor bundle 来捆绑程序.因此,临时构建文件夹似乎不是一个有效的选项.

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.

meteor 中的 Npm 发生了什么?Npm 包的最新使用方式是什么?

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

在相关说明中,我正在尝试使用 Amazon SDK(用于 s3) - 将其打包为 Meteorite 包会更好吗?

推荐答案

Arunoda 已经创建了一个 NPM Atmosphere 包,允许您可以像以前一样使用任何 NPM 模块.很简单.

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

首先,mrt add npm.

您也可以使用 npm install -g meteor-npm 中的 meteor-npm 命令安装包.

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

接下来,在您的项目根目录中创建一个 packages.json 文件,其中包含包名称和版本:

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"
}

最后,将它们与 Meteor.require 一起使用,如下所示:var FooBar = Meteor.require('foobar');

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

这篇关于2013 Meteor NPM 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆