2014-02-08 26 views
0

我的應用程序在本地完全運行。但是,當我部署它時,我收到在收集帖子被假定被訪問的頁面上的JavaScript控制檯中收到以下錯誤。使用Iron Router訪問部署應用程序的集合時出現Meteor ReferenceError

Exception from Deps recompute: ReferenceError: Posts is not defined 
at Object.route.data.posts 

這裏是我使用的JavaScript文件,該文件傳遞到帖子部署時不會加載模板postsLists路由器。


Router.configure({ 
      layoutTemplate: 'layout', 
      loadingTemplate: 'loading', 
      waitOn: function() { console.log('waiting'); return [Meteor.subscribe('posts'), Meteor.subscribe('files')]; } 
     }); 

     Router.map(function(){ 
      this.route('postPage', { 
       path:'/posts/:_id', 
       data: function() {return Posts.findOne(this.params._id); } 
      }); 

      this.route('welcome', {path: '/'}); 

      this.route('postsList', {path: '/List', 
      data: { 
       posts: function() { 
       return Posts.find({}, {sort: {submitted: -1}}); 
       } 
      }}); 

      this.route('postSubmit',{ 
       path:'/submit' 
      }); 
      this.route('yourPosts',{ 
       path:'/yourposts' 
      }); 
      this.route('officialPosts',{ 
       path:'/featured' 
      }); 
      this.route('postEdit', { 
      path: '/posts/:_id/edit', 
      data: function() { return Posts.findOne(this.params._id); } 
      }); 
     }); 

     var requireLogin = function(){ 
      if(! Meteor.user()){ 
       this.render('accessDenied'); 
       this.stop(); 
      } 
     }; 

     Router.before(requireLogin, {only: ['postSubmit','postsList','yourPosts','officialPosts','postEdit']}); 

該網站也是在fed.meteor.com訪問。

在此先感謝。

回答

1

你有一個javascript錯誤,你可以看到它在js控制檯中,當它說Uncaught TypeError: Object #<Object> has no method 'describe'

在生產模式下文件是連接的,所以當你有這樣的錯誤時,下面的代碼根本不會執行。所以這種方式郵政沒有定義。

你仍然有本地錯誤,但文件不連接,因此一個錯誤不會影響其他文件,錯誤不會那麼明顯。

您必須修復其他錯誤以使其餘代碼運行。

尼斯網站btw。

+0

是的!那正是我需要的。我不知道使用的bootstrap-3軟件包被放置在提供樣式的客戶端文件夾中,除了accounts-ui-bootstrap-3軟件包以外,這些軟件包使得所有功能都有錯誤。將它放在packages文件夾中修復了錯誤。 – user3286942

相關問題