i have this in my code
var queries = require('./Queries.js');
when start the node server in windows cmd is ok.
I clone the proyect in a linux ec2 server , but when i start the server not works
Error: Cannot find module './Queries.js'
i have this in my code
var queries = require('./Queries.js');
when start the node server in windows cmd is ok.
I clone the proyect in a linux ec2 server , but when i start the server not works
Share Improve this question edited Oct 27, 2016 at 5:07 Dave 3,0917 gold badges22 silver badges33 bronze badges asked Oct 27, 2016 at 1:49 Juan SalamancaJuan Salamanca 3544 silver badges9 bronze badges 2Error: Cannot find module './Queries.js'
-
5
On Windows, filenames are case insensitive. On Linux, files are case sensitive. Are you sure your file is located in the proper location and is named
Queries.js
with that capitalization? – jfriend00 Commented Oct 27, 2016 at 2:19 - yes, that's was the problem, thanks – Juan Salamanca Commented Dec 5, 2016 at 13:53
2 Answers
Reset to default 6Making my ment into an answer since this seems to have been your issue:
On Windows, filenames are case insensitive. On Linux, files are case sensitive. This is a mon platform difference for anyone writing cross platform code for these two platforms.
So, make sure your file is located in the proper location and is named Queries.js
with that exact capitalization.
I generally find it best to just never use mixed case (always all lowercase) in programming filenames and then you never have this issue.
Edit:
Verify the path to 'Queries.js'
Case 1) Assuming you have NodeJS installed, the correct syntax you are looking for is below
var queries = require('querystring');
Case 2) :However if you are referencing code in another javascript file put something similar to the below at the top of current file.
require('./Queries.js'); //Queries.js is in the current directory
or
require('./path/to/Queries.js'); //The path to Queries.js