Parse-server: Error: Cannot find module './cloud/modules/file.js'

Created on 25 Feb 2016  路  2Comments  路  Source: parse-community/parse-server

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.

Most helpful comment

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.

All 2 comments

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.

@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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lorki picture lorki  路  3Comments

ugo-geronimo picture ugo-geronimo  路  3Comments

ShawnBaek picture ShawnBaek  路  4Comments

darkprgrmmr picture darkprgrmmr  路  4Comments

mohmagdy picture mohmagdy  路  3Comments