我是Bluemix和node.js的新手。我有一个node.js应用程序,我想在Bluemix中运行,但我不知道如何实际运行node.js。当我尝试在bluemix上打开网站时,我的javascript文件有错误,即未定义require函数,这意味着node.js没有运行。我是否应该更改package.json文件中的某些内容以允许特定的javascript文件运行node.js或者什么?抱歉这么无能为力。
最新的日志文件:
2016-03-12T16:31:17.522-0500[API/1]OUTApp instance exited with guid 07407575-72e1-4bcf-9344-62c83d0d533e payload: {"cc_partition"=>"default", "droplet"=>"07407575-72e1-4bcf-9344-62c83d0d533e", "version"=>"b98560f6-3880-41bf-b1b8-ccb372e093a4", "instance"=>"970f43d31dfb45ab81ac16ec4d6648fd", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1457818277}
2016-03-12T16:31:17.646-0500[API/1]OUTApp instance exited with guid 07407575-72e1-4bcf-9344-62c83d0d533e payload: {"cc_partition"=>"default", "droplet"=>"07407575-72e1-4bcf-9344-62c83d0d533e", "version"=>"b98560f6-3880-41bf-b1b8-ccb372e093a4", "instance"=>"970f43d31dfb45ab81ac16ec4d6648fd", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1457818277}
2016-03-12T16:44:06.690-0500[DEA/103]OUTStarting app instance (index 0) with guid 07407575-72e1-4bcf-9344-62c83d0d533e
2016-03-12T16:44:19.047-0500[App/0]ERRError: Cannot find module 'extend'
2016-03-12T16:44:19.047-0500[App/0]ERR at Module.load (module.js:344:32)
2016-03-12T16:44:19.047-0500[App/0]ERR at Function.Module._load (module.js:277:25)
2016-03-12T16:44:19.047-0500[App/0]ERR at Module.require (module.js:354:17)
2016-03-12T16:44:19.047-0500[App/0]ERR at Object.<anonymous> (/home/vcap/app/node_modules copy/watson-developer-cloud/lib/index.js:22:20)
2016-03-12T16:44:19.047-0500[App/0]ERRmodule.js:328
2016-03-12T16:44:19.047-0500[App/0]ERR at require (internal/module.js:12:17)
2016-03-12T16:44:19.047-0500[App/0]ERR ^
2016-03-12T16:44:19.047-0500[App/0]ERR throw err;
2016-03-12T16:44:19.047-0500[App/0]ERR at Object.Module._extensions..js (module.js:417:10)
2016-03-12T16:44:19.047-0500[App/0]ERR at Function.Module._load (module.js:301:12)
2016-03-12T16:44:19.047-0500[App/0]ERR at Module._compile (module.js:410:26)
2016-03-12T16:44:19.047-0500[App/0]ERR at Module.require (module.js:354:17)
2016-03-12T16:44:19.047-0500[App/0]ERR at Function.Module._resolveFilename (module.js:326:15)
2016-03-12T16:44:19.054-0500[App/0]OUT
2016-03-12T16:44:19.124-0500[DEA/103]ERRInstance (index 0) failed to start accepting connections
2016-03-12T16:44:19.152-0500[API/5]OUTApp instance exited with guid 07407575-72e1-4bcf-9344-62c83d0d533e payload: {"cc_partition"=>"default", "droplet"=>"07407575-72e1-4bcf-9344-62c83d0d533e", "version"=>"b98560f6-3880-41bf-b1b8-ccb372e093a4", "instance"=>"5db58117c8a44c6992e4ba7005c33206", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1457819059}
2016-03-12T16:44:19.173-0500[API/1]OUTApp instance exited with guid 07407575-72e1-4bcf-9344-62c83d0d533e payload: {"cc_partition"=>"default", "droplet"=>"07407575-72e1-4bcf-9344-62c83d0d533e", "version"=>"b98560f6-3880-41bf-b1b8-ccb372e093a4", "instance"=>"5db58117c8a44c6992e4ba7005c33206", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1457819059}
忘掉我对node.js函数的看法。我在这个应用程序中使用视觉识别和没有错误运行的文件之前没有包括我的所有文件。将我的项目的其余部分推送到bluemix后,我在上面的日志文件中遇到了错误。我推送的文件是视觉识别watson api所需的node_modules以及app.js发出的api调用。