2016-10-13 35 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 
    } 
};