1

I would like to use the first function sayHello in my jobs.js in parse-server-example.

In my jobs.js I have this:

var Parse = require('parse/node');
Parse.initialize('xx', 'xx','xx');
Parse.serverURL = 'xx';
Parse.Cloud.useMasterKey();

function sayHello() {
console.log('Hello');
}

I tried to run it with this terminal line command:

heroku run sayHello -a myAppName

returns:

Running sayHello on myAppName... up, run.6148
bash: sayHello: command not found
4

1 回答 1

4

You should put the job you want to run in its own file (without a .js extension) outside of a function.

    var Parse = require('parse/node');
    Parse.initialize('xx', 'xx','xx');
    Parse.serverURL = 'xx';
    console.log('Hello');

You can then run the following from the command line.

    heroku run node nameOfFile --app yourAppName
于 2016-03-31T15:11:48.803 回答