我正在尝试找出将npm软件包加载到Meteor应用中的方法,具体而言,我使用了future-npm
。
我已经尝试了以下方法:
Package.describe({
summary: "Blah blah",
version: '0.0.1'
});
Npm.depends({future: "2.3.1"});
Package.onUse(function (api) {
api.addFiles('lubert.js', 'server');
api.export('Lubert');
});
很抱歉,我遇到了以下控制台错误。
Uncaught ReferenceError: Npm is not defined
我已经阅读了文档,但没有关于如何加载任何依赖项的内容。
我做错了什么?
更新2:我的package.js文件如下:
Package.describe({
name: 'trepafi:package',
summary: '',
version: '0.0.3',
git: 'https://github.com/trepafi/meteor-package.git'
});
Npm.depends({
"future": "2.3.1"
});
Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use(['tracker', 'underscore'], ['client']);
api.addFiles(['package.js'], ['client']);
api.export('Package', ['client']);
});
更新1: 我的package.json文件如下:
{
"name": "trepafi-package",
"version": "0.0.3",
"description": "Package for Meteor",
"repository": {
"type": "git",
"url": "https://github.com/trepafi/meteor-package.git"
},
"author": "Lubert Palacios",
"license": "MIT",
"homepage": "https://github.com/trepafi/meteor-package",
"dependencies": {
"future": "^2.3.1"
}
}
我也尝试过使用meteorhacks:npm,但没有成功。 如果能使用“本地”的方法就太好了。