Javascript Meteor应用程序在调用方法时崩溃

Javascript Meteor应用程序在调用方法时崩溃,javascript,meteor,Javascript,Meteor,我有一个集合,其中使用以下代码插入了多个文档: Projects.insert({ source: "https://upload.wikimedia.org/wikipedia/commons/7/7f/Pug_portrait.jpg", title: "Pug", artist: "pug", description: "This piece shows the duality of pug", price: "$50" }); Projects.

我有一个集合,其中使用以下代码插入了多个文档:

Projects.insert({
    source: "https://upload.wikimedia.org/wikipedia/commons/7/7f/Pug_portrait.jpg",
    title: "Pug",
    artist: "pug",
    description: "This piece shows the duality of pug",
    price: "$50"
});

Projects.insert({
    source: "http://c.fastcompany.net/multisite_files/fastcompany/poster/2014/01/3025003-poster-p-dog-2.jpg",
    title: "Dog",
    artist: "dog",
    description: "much doge, many deal with it, wow",
    price: "$50"
})

Projects.insert({
    source: "https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg/1280px-Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg",
    title: "Starry Night",
    artist: "van gogh",
    description: "night sky with stars",
    price: "$75"
})

Projects.insert({
    source: "http://totallyhistory.com/wp-content/uploads/2012/03/The_Scream.jpg",
    title: "Scream",
    artist: "edvard",
    description: "scream",
    price: "$50"
})

Projects.insert({
    source: "https://www.petfinder.com/wp-content/uploads/2012/11/dog-how-to-select-your-new-best-friend-thinkstock99062463.jpg",
    title: "Dog 2",
    artist: "Bittu",
    description: "This is a test to see how an actual thing would work",
    price: "$50"
})
我创建了以下方法:

Meteor.methods({
  addProject: function (source, title, artist, description, price) {
    // Make sure the user is logged in before inserting a task
    if (! Meteor.userId()) {
      throw new Meteor.Error("not-authorized");
    }

    Projects.insert({
      source: source,
      title: title,
      artist: artist,
      description: description,
      price: price
    });
  }
});
当我尝试调用该方法时,应用程序崩溃并引用以下代码行:

Meteor.call("addProject", "http://mybuzzblog.com/wp-content/uploads/2014/12/German-Shepherds.jpg", "Dog 3", "Me", "happy dog", "$60");
以下是控制台显示的内容

W20150729-12:26:31.609(-4)? (STDERR)
W20150729-12:26:31.610(-4)? (STDERR) C:\Users\Raj\AppData\Local\.meteor\packages
\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fiber
s\future.js:245
W20150729-12:26:31.610(-4)? (STDERR)
throw(ex);
W20150729-12:26:31.610(-4)? (STDERR)
      ^
W20150729-12:26:31.610(-4)? (STDERR) Error: Method not found [404]
W20150729-12:26:31.610(-4)? (STDERR)     at [object Object]._.extend.apply (pack
ages/ddp/livedata_server.js:1502:1)
W20150729-12:26:31.613(-4)? (STDERR)     at [object Object]._.extend.call (packa
ges/ddp/livedata_server.js:1472:1)
W20150729-12:26:31.613(-4)? (STDERR)     at app\art.js:5:8
W20150729-12:26:31.613(-4)? (STDERR)     at app\art.js:137:3
W20150729-12:26:31.613(-4)? (STDERR)     at C:\Users\Raj\art\.meteor\local\build
\programs\server\boot.js:222:10
W20150729-12:26:31.614(-4)? (STDERR)     at Array.forEach (native)
W20150729-12:26:31.614(-4)? (STDERR)     at Function._.each._.forEach (C:\Users\
Raj\AppData\Local\.meteor\packages\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bu
ndle\server-lib\node_modules\underscore\underscore.js:79:11)
W20150729-12:26:31.614(-4)? (STDERR)     at C:\Users\Raj\art\.meteor\local\build
\programs\server\boot.js:117:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.

如何解决此问题?

确保Meteor.methods位于服务器文件夹下或Meteor.isServer条件下。

确保Meteor.methods位于服务器文件夹下或Meteor.isServer条件下。

在哪里定义方法?在哪里定义方法?