将Nodejs Express框架示例应用程序部署到AppEngine

时间:2017-01-04 07:07:41

标签: node.js google-app-engine express

我已从存储库https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine/express

下载了Expressjs示例应用程序

然后使用

进行部署
  

gcloud app deploy

过程继续,过了一段时间后它会给出以下错误

Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:

> appengine-express@0.0.1 start /app
> node ./bin/www

module.js:471
    throw err;
    ^

Error: Cannot find module '/app/bin/www'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "start"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! appengine-express@0.0.1 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appengine-express@0.0.1 start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the appengine-express package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs appengine-express
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls appengine-express
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /app/npm-debug.log

我能够看到在应用引擎信息中心中创建的版本,但无法启动应用程序。

我尝试从同一个仓库部署其他样本https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine/hello-world一切正常。

我从两个样本中观察到的是当节点尝试从父文件夹导入文件时,如下所示,它无法启动

.....
const app = require('../app');
.....

这里有什么问题,我错过了什么?

1 个答案:

答案 0 :(得分:0)

Google Cloud SDK中存在一个错误,该错误已修复,部署过程中某些源文件夹未正确上传。

https://code.google.com/p/google-cloud-sdk/issues/detail?id=1431