[Meteor shell] How call server side method

I like to use meteor shell for calling a server side method as it is described here.

But I have got in shell the following response:

Meteor.call(‘processMails’)

Error: Cannot find module './lib/virtual-types’
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (C:\Users\user\AppData\Local.meteor\packages\babel-compiler\6.5.2\npm\node_modules\meteor-babel\node_modules\babel-pre
les\babel-traverse\lib\path\index.js:13:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions…js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

What I do wrong?

It’s telling you that the module where you defined the ‘processMails’ method can’t import another module from the location you specified:

// methods/processMails.js

import './lib/virtual-types';

// will look for:
// methods/lib/virtual-types.js
or
// methods/lib/virtual-types/index.js

I’m confused.
Because I can call this method from client side as is.
So I still think that it is meteor shell issue

Can you show us your Method code? Also, are you using Meteor 1.3 and are your leveraging the new /imports (lazy loading) functionality?

An outline of your directory involving these files would also be helpful

1 Like

Yes. i use Meteor 1.3

Meteor.methods({
    'processMails': function () {
        var manager = new IncomingMailManager();
        manager.processNewFiles();
    }
});

Meteor.call(“processMails”) already works fine from browser console

If I have changed method implementation to

Meteor.methods({
    'processMails': function () {
       console.log(123);
    }
});

it doesn’t work too

Okay - as @reoh mentioned, can you show us where you’re defining your method, within your directory structure?

File with method is located at path
app_root/api/templates/server/methods.js

Shell works fine after update Meteor to 1.3.1