我刚刚完成了Meteor包的开发。现在我想通过将其添加到新的Meteor应用程序来测试它:
my_cool_package_name / package.js
Package.on_use(function(api){
api.use("accounts-password@1.1.1");
});
将my_cool_package_name添加到新项目
meteor add my_cool_package_name
Changes to your project's package version selections:
accounts-base added, version 1.2.0
accounts-password added, version 1.1.1
列出已安装的软件包
meteor list
meteor-platform 1.2.2 Include a standard set of Meteor packages in your app
my_cool_package_name 1.0.0+ This is my_cool_package_name
启动流星
meteor
ReferenceError: Accounts is not defined
W20150817-15:30:49.707(-4)? (STDERR) at manage_users_log.insert.username (app/server/fixtures.js:7:17)
W20150817-15:30:49.707(-4)? (STDERR) at Array.forEach (native)
W20150817-15:30:49.707(-4)? (STDERR) at Function._.each._.forEach (packages/underscore/underscore.js:105:1)
W20150817-15:30:49.708(-4)? (STDERR) at app/server/fixtures.js:6:4
W20150817-15:30:49.708(-4)? (STDERR) at app/server/fixtures.js:36:3
W20150817-15:30:49.708(-4)? (STDERR) at /Users/me/Documents/meteor/my_app/.meteor/local/build/programs/server/boot.js:222:10
W20150817-15:30:49.708(-4)? (STDERR) at Array.forEach (native)
W20150817-15:30:49.708(-4)? (STDERR) at Function._.each._.forEach (/Users/me/.meteor/packages/meteor-tool/.1.1.4.1kp2n64++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20150817-15:30:49.708(-4)? (STDERR) at /Users/me/Documents/meteor/my_app/.meteor/local/build/programs/server/boot.js:117:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
服务器/ fixtures.js
if (Meteor.users.find().count() === 0) {
var users = [
{username:'admin',email:'admin@example.com',password:'adminadmin',roles:['admin'],status:'enabled',profile:{first_name:'admin',last_name:'admin'}},
{username:'user',email:'user@example.com',password:'useruser',roles:['user'],status:'enabled',profile:{first_name:'user',last_name:'user'}}
];
_.each(users, function(user){
var user_id = Accounts.createUser({
username: user.username,
email: user.email,
password: user.password,
profile: {
first_name: user.profile.first_name,
last_name: user.profile.last_name,
}
});
Meteor.users.update(
{_id: user_id},
{$set:
{
roles: user.roles,
status: user.status
}
}
);
});
}
if (manage_users_log.find().count() === 0) {
manage_users_log.insert({
username: "admin",
category: "server_startup",
description: "Meteor server started."
});
}
如果有帮助,应用程序结构的布局如下:
client
my_app.html
packages
my_cool_package_name
server
fixtures.js
答案 0 :(得分:2)
使用apple
banana
为您的应用授予对包依赖项的导出符号的访问权限。
api.imply
根据其他软件包添加软件包时,主应用程序无法使用其导出的符号,您需要暗示它们才能实现此目的。