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

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

server.js jelastic node.log 文件错误

我正在尝试发布使用 nodejs expressejs 创建的简单 bootstrap 页面,但服务器说 504 Gateway timeout 而不能 运行 它。此外,nodejs log 文件显示如下错误:

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 npm@3.6.0 npm info using node@v5.6.0 npm info lifecycle DrawingGame@0.0.1~prestart: DrawingGame@0.0.1 npm info lifecycle DrawingGame@0.0.1~start: DrawingGame@0.0.1  > DrawingGame@0.0.1 

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

我的简单代码位于 GitHubhttps://github.com/penjav/metse

我关注了 turotrial:https://docs.jelastic.com/nodejs-git-svn

但是没有运气。请指导我。并告诉我错误。 非常感谢。

此错误是由于您的项目结构不正确造成的。 NodeJS 部署脚本希望在根目录中找到文件 "server.js" 或 "package.json",但在您的情况下,这些文件并未放置在那里(它们放置在子目录中)。

您需要更改项目结构并重新部署项目。