2016-10-13 32 views
0

我想使用meteor-admin。我安装了所有内容并打开链接localhost:PORT/admin。从那以后,我在root/client/admin.jsroot/server/entry.js粘贴此代码:如何使用流星管理

AdminConfig = { 
    adminEmails: [' [email protected]'], 
    collections: 
    { 
     Posts: {}, 
     Comments: {} 
    } 
} 

我也试着创造root/为客户端和服务器的全局文件。问题是客户端文件可以正常工作,但在localhost:PORT/admin页面上给出了行You need to be an admin to view this page。当我在root/server添加所需的代码,我得到这个错误:

=> Exited with code: 1 
I20161013-19:43:24.308(5.5)? ** You've set up some data subscriptions with Meteor.publish(), but 
I20161013-19:43:24.308(5.5)? ** you still have autopublish turned on. Because autopublish is still 
I20161013-19:43:24.309(5.5)? ** on, your Meteor.publish() calls won't have much effect. All data 
I20161013-19:43:24.309(5.5)? ** will still be sent to all clients. 
I20161013-19:43:24.309(5.5)? ** 
I20161013-19:43:24.309(5.5)? ** Turn off autopublish by removing the autopublish package: 
I20161013-19:43:24.309(5.5)? ** 
I20161013-19:43:24.309(5.5)? ** $ meteor remove autopublish 
I20161013-19:43:24.310(5.5)? ** 
I20161013-19:43:24.310(5.5)? ** .. and make sure you have Meteor.publish() and Meteor.subscribe() calls 
I20161013-19:43:24.310(5.5)? ** for each collection that you want clients to see. 
I20161013-19:43:24.310(5.5)? 
W20161013-19:43:24.553(5.5)? (STDERR) /home/cortana/.meteor/packages/meteor-tool/.1.4.1_2.354htk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280 
W20161013-19:43:24.553(5.5)? (STDERR)      throw(ex); 
W20161013-19:43:24.554(5.5)? (STDERR)      ^
W20161013-19:43:24.554(5.5)? (STDERR) 
W20161013-19:43:24.554(5.5)? (STDERR) Error: Posts is not in the [object global] 
W20161013-19:43:24.554(5.5)? (STDERR)  at Assets.lookup (packages/yogiben_admin/lib/both/utils.coffee:22:14) 
W20161013-19:43:24.554(5.5)? (STDERR)  at Assets.adminCollectionObject (packages/yogiben_admin/lib/both/utils.coffee:5:3) 
W20161013-19:43:24.554(5.5)? (STDERR)  at packages/yogiben_admin/lib/both/startup.coffee:63:16 
W20161013-19:43:24.555(5.5)? (STDERR)  at Function._.each._.forEach (packages/underscore/underscore.js:113:1) 
W20161013-19:43:24.555(5.5)? (STDERR)  at adminCreateTables (packages/yogiben_admin/lib/both/startup.coffee:36:4) 
W20161013-19:43:24.555(5.5)? (STDERR)  at packages/yogiben_admin/lib/both/startup.coffee:166:2 
W20161013-19:43:24.555(5.5)? (STDERR)  at /home/cortana/Desktop/deeplibrary/.meteor/local/build/programs/server/boot.js:299:5 
=> Exited with code: 1 
I20161013-19:43:27.957(5.5)? ** You've set up some data subscriptions with Meteor.publish(), but 
I20161013-19:43:27.957(5.5)? ** you still have autopublish turned on. Because autopublish is still 
I20161013-19:43:27.959(5.5)? ** on, your Meteor.publish() calls won't have much effect. All data 
I20161013-19:43:27.960(5.5)? ** will still be sent to all clients. 
I20161013-19:43:27.960(5.5)? ** 
I20161013-19:43:27.960(5.5)? ** Turn off autopublish by removing the autopublish package: 
I20161013-19:43:27.960(5.5)? ** 
I20161013-19:43:27.960(5.5)? ** $ meteor remove autopublish 
I20161013-19:43:27.961(5.5)? ** 
I20161013-19:43:27.961(5.5)? ** .. and make sure you have Meteor.publish() and Meteor.subscribe() calls 
I20161013-19:43:27.961(5.5)? ** for each collection that you want clients to see. 
I20161013-19:43:27.961(5.5)? 
W20161013-19:43:28.246(5.5)? (STDERR) /home/cortana/.meteor/packages/meteor-tool/.1.4.1_2.354htk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280 
W20161013-19:43:28.246(5.5)? (STDERR)      throw(ex); 
W20161013-19:43:28.246(5.5)? (STDERR)      ^
W20161013-19:43:28.246(5.5)? (STDERR) 
W20161013-19:43:28.247(5.5)? (STDERR) Error: Posts is not in the [object global] 
W20161013-19:43:28.247(5.5)? (STDERR)  at Assets.lookup (packages/yogiben_admin/lib/both/utils.coffee:22:14) 
W20161013-19:43:28.247(5.5)? (STDERR)  at Assets.adminCollectionObject (packages/yogiben_admin/lib/both/utils.coffee:5:3) 
W20161013-19:43:28.247(5.5)? (STDERR)  at packages/yogiben_admin/lib/both/startup.coffee:63:16 
W20161013-19:43:28.247(5.5)? (STDERR)  at Function._.each._.forEach (packages/underscore/underscore.js:113:1) 
W20161013-19:43:28.247(5.5)? (STDERR)  at adminCreateTables (packages/yogiben_admin/lib/both/startup.coffee:36:4) 
W20161013-19:43:28.247(5.5)? (STDERR)  at packages/yogiben_admin/lib/both/startup.coffee:166:2 
W20161013-19:43:28.248(5.5)? (STDERR)  at /home/cortana/Desktop/deeplibrary/.meteor/local/build/programs/server/boot.js:299:5 
=> Exited with code: 1 
=> Your application is crashing. Waiting for file change. 

我应该怎么做删除这个错误?为什么这个错误在这里? PS:

我也试过此代码为root/server,得到了同样的错误:

AdminConfig = { 
    roles: ['admin'], 
    collections: { 
    Posts: {} 
    } 
}; 

回答

0

你需要从应用程序中删除软件包自动发布。

meteor remove autopublish 

您还需要定义您的Posts集合来解决另一个问题。

Error: Posts is not in the

+0

这行不通。我删除了自动发布模块,但现在应用程序不启动。它只是停留在'开始你的应用程序'。 –

0

的情况下,你有自己的帖子收藏尝试像

import { Posts } from '../imports/api/posts/posts.js'; // or wherever your Posts collection is defined 
AdminConfig = { 
    roles: ['admin'], 
    collections: { 
    Posts: { collectionObject: Posts} // tell about collectionObject 
    } 
};