简体   繁体   English

流星:意外令牌}

[英]Meteor: Unexpected token }

I'm getting the following error on my meteor app (using meteor-boilerplate) 我在流星应用程序上遇到以下错误(使用流星样板)

server/startup/loadPlugins.js:12:3: Unexpected token }

This is the code: 这是代码:

  1 Meteor.startup(function () {
  2
  3   //load plugins
  4   if(Plugins.find().count() === 0) {
  5     var plugins = JSON.parse(Assets.getText('plugins.json'));
  6     _.each(plugins, (function () {
  7       plugins.insert({
  8         plugin_name: data
  9       });
 10       console.log('added plugin record');
 11     })
 12   }
 13
 14 }

Not sure what I'm doing wrong here. 不知道我在做什么错。 I have another file models/plugins.js which creates the collection: 我还有另一个文件models/plugins.js来创建集合:

plugins = new Mongo.Collection('plugins');

_.each未正确关闭。

Try this: 尝试这个:

Meteor.startup(function () {

  //load plugins
  if(Plugins.find().count() === 0) {
    var plugins = JSON.parse(Assets.getText('plugins.json'));
    _.each(plugins, (function () {
      plugins.insert({
        plugin_name: data
      });
      console.log('added plugin record');
    }));
  }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM