Skip to content

Error on adding code to parse server example project #1661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
candork opened this issue Apr 28, 2016 · 3 comments
Closed

Error on adding code to parse server example project #1661

candork opened this issue Apr 28, 2016 · 3 comments

Comments

@candork
Copy link

candork commented Apr 28, 2016

I have followed instruction here http://blog.parse.com/learn/parse-server-video-series-april-2016/

And installed the parse sever locally, I ran the parse server and it worked fine.

Next, I added my cloud code directory, it replaced my main.js file. Now when I run the server (npm start) it I get this error

npm start

> [email protected] start /Users/r/parse-backend
> node index.js

module.js:341
    throw err;
    ^

Error: Cannot find module '/cloud/playCountUpdate.js'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/r/parse-backend/cloud/main.js:6:1)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/5.11.0/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.11.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'node index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the parse-server-example package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs parse-server-example
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls parse-server-example
npm ERR! There is likely additional logging output above.

Here is how my cloud code file looks

require('/cloud/playCountUpdate.js');
Parse.Cloud.define('hello_2', function(req, res) {
  res.success('Hi');
});
@hramos
Copy link
Contributor

hramos commented Apr 28, 2016

Have you tried require('playCountUpdate') or other variations? There are several videos in the page you linked, can you specify which steps you followed?

@candork
Copy link
Author

candork commented Apr 28, 2016

Thanks for all your work @hramos! I have learned a lot from all your answers/articles/docs 👍

So, I tried them all and finally found that this works:

require('../cloud/activityJob.js');

I think you should update the document - https://github.com/ParsePlatform/parse-server/wiki/Migrating-an-Existing-Parse-App#3-cloud-code

The video I was referring to was, this - https://www.youtube.com/watch?v=o522ovITvW4

Thanks again! :)

@hramos hramos closed this as completed Apr 28, 2016
@jessicahzuber
Copy link

@candork is activityJob.js a separate file? How did this help npm to locate your playCountUpdate.js module?

I'm having a similar problem and I'm wondering if there's a separate file I need to create and/or require in my main.js or index.js file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants