我是Google App Engine的新手,并且有一个我正在从GitHub存储库中部署的node.js应用程序。
当我cd
进入应用程序目录然后运行时
forever start index.js
我能够运行Web预览,并且该应用程序可以通过url很好地进行预览:
https://8080-dot-4748721-dot-devshell.appspot.com/?authuser=0
但是,当我转到应用程序的网址时:
https://lucidnodes-dev.appspot.com/
我收到500错误:
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
几天后:
我需要一些帮助。
这是我的服务器代码:
server.js文件:
const express = require('express');
const path = require('path');
const url = require('url');
var init = function( app, prt ){
app.listen( prt, () => console.log('LucidNodes listening on port ' , prt ));
};
exports.init = init;
和index.js文件:
const server = require('./server');
const fs = require('fs');
const express = require('express');
const path = require('path');
const serveStatic = require('serve-static');
const serveIndex = require('serve-index');
const staticPaths = require('./defineStaticPaths');
const htmlMethods = require('./js/htmlMethods'); // import custom methods for handling HTML
const app = express();
const routes = require('./routes');
staticPaths.defineStaticPaths( app );
app.use( routes );
server.init( app, 8080 );
和我的app.yaml文件,该文件位于LucidNodes目录中:
runtime: nodejs10
instance_class: F2
env_variables:
BUCKET_NAME: "example-gcs-bucket"
handlers:
- url: /stylesheets
static_dir: stylesheets
- url: /.*
secure: always
redirect_http_response_code: 301
script: auto
network:
forwarded_ports:
- 8080/tcp
我期望发生的是,我浏览到https://lucidnodes-dev.appspot.com/并启动了应用程序。由于花了我一周的时间才开始弄清如何谈论这个问题,因此我们将为您提供所有帮助。
谢谢。