2014-02-08 25 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

相关问题