joe
joe

Reputation: 15

Error: Cannot find module '/opt/repo/ROOT/server.js

server.js error on jelastic node.log file

I am trying publish simple bootstrap page create with nodejs express and ejs but the server is saying 504 Gateway timeout and couldn't run it. Also, the nodejs log file is showing error like this:

Thu Mar 02 2017 01:26:47 GMT+0000 (UTC): Starting application 'nodejs' ... npm info it worked if it ends with ok npm info using [email protected] npm info using [email protected] npm info lifecycle [email protected]~prestart: [email protected] npm info lifecycle [email protected]~start: [email protected]  > [email protected] 

start /opt/repo/ROOT > node server.js  
Thu Mar 02 2017 01:28:55 GMT+0000 (UTC): Stopping application 'nodejs' ... 

Thu Mar 02 2017 01:28:55 GMT+0000 (UTC): Stopped Node application 'nodejs' Thu Mar 02 2017 01:28:55 GMT+0000 (UTC): Starting application 'nodejs' ... Script = server.js Script Args =  Node Options =  module.js:341 throw err; ^  Error: Cannot find module '/opt/repo/ROOT/server.js' at Function.Module._resolveFilename (module.js:339:15) at Function.Module._load (module.js:290:25) at Function.Module.runMain (module.js:447:10) at startup (node.js:140:18) at node.js:1001:3 Thu Mar 02 2017 01:32:04 GMT+0000 (UTC): Starting application 

'nodejs' ... Script = server.js Script Args =  Node Options =  module.js:341 

throw err; ^  

Error: Cannot find module '/opt/repo/ROOT/server.js' 

at Function.Module._resolveFilename (module.js:339:15) at Function.Module._load (module.js:290:25) at Function.Module.runMain (module.js:447:10) at startup (node.js:140:18) at node.js:1001:3

My simple code is at GitHub: https://github.com/penjav/metse and

i followed turotrial at: https://docs.jelastic.com/nodejs-git-svn

But have no luck. please guide me. and show me the errors. thank you very much.

Upvotes: 1

Views: 5816

Answers (1)

Virtuozzo
Virtuozzo

Reputation: 1993

This error has been occurred due to the incorrect structure of your project. NodeJS deploying script expects to find file "server.js" or "package.json" in the root directory, but in your case these files aren't placed there (they are placed in sub-directory).

You need to change project structure and redeploy the project.

Upvotes: 2

Related Questions