2016-10-13 6 views
0

meteor-adminを使ってみました。私はすべてをインストールし、リンクlocalhost:PORT/adminを開いた。その後、私はroot/client/admin.jsroot/server/entry.jsにこのコードを貼り付け:meteor-adminの使い方

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

私はまた、クライアントとサーバの両方のためのroot/のグローバルファイルを作成してみました。クライアントファイルが正常に動作しているのに、ページに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

あなたのアプリからautopublishパッケージを削除する必要があります。

meteor remove autopublish 

また、投稿コレクションを定義して、別の問題を解決する必要があります。

Error: Posts is not in the

+0

のようなものを試してみる場合に。私はautopublishモジュールを削除しましたが、今はアプリが起動しません。それはちょうど 'あなたのアプリを起動します。 –

0

あなたがあなた自身の投稿のコレクションは仕事をdoesntの

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