Skip to content

Error: Cannot find module './cloud/modules/file.js' #638

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
astanton opened this issue Feb 25, 2016 · 2 comments
Closed

Error: Cannot find module './cloud/modules/file.js' #638

astanton opened this issue Feb 25, 2016 · 2 comments

Comments

@astanton
Copy link

I am in the process of migrating to our own hosted parse-server and am going through setting it up locally. I am at the point where I am trying to run the cloud code locally. I moved it over to the /cloud directory in the parse-server-example directory. I then saw the note about modifying local paths to have ./ infront of the cloud path, and I noticed looking at the structure of the folders why that makes sense, with main.js being in the /cloud directory, it has to go down, then back into the cloud directory to find the modules directory.

I had a require('cloud/modules/file.js') which worked fine in the Parse.com server.

I changed it to require('./cloud/modules/file.js') as stated in the tutorial, however I am getting that error that is in the topic title.

Is there a step that I am missing or something? Everything looks to be correct path wise so I'm a bit baffled as to why this is not working.

@refre5h
Copy link

refre5h commented Feb 25, 2016

I think I had the same issue before. It depends on the location of your file that requires the file.js.

I have file structure like so:

cloud/
 |__main.js
 |__modules/
      |__file.js

My main.js, located in the cloud/ folder, requires file.js in the cloud/modules/ folder, changing the require path in my main.js to require('./modules/file.js') fixes the issue.

Hope that helps.

@astanton
Copy link
Author

@refre5h thanks for the hint, that was the problem. I also had to fix some paths down in other modules as well, but it looks like I got it up and running now! Thanks again!

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

2 participants