我正在使用 Google App Engine 部署測驗應用程式。部署作業正常,當我將瀏覽器指向以下 URL 時,我收到 HTTP 500 錯誤: https ://test-gae-365706.uc.r.appspot.com/
我的應用程式代碼如下:
const http = require('http');
const port = 8080;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Do not have an inflated sense of yourself. You are just food for worms.');
});
server.listen(port, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
我的app.yaml檔案如下:
runtime: nodejs10
我的package.json檔案如下:
{
"name": "app-engine",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "node app.js"
},
"engines": {
"node": "10.x.x"
},
"author": "",
"license": "ISC"
}
當我運行時glcoud app deploy,我沒有收到任何錯誤,但是當我將瀏覽器指向 URL 時,我收到 HTTP 500 錯誤:
Error: Server Error The server encountered an error and could not complete your request. Please try again in 30 seconds.
在導航窗格中,當我轉到Instances頁面時,我看到沒有創建任何實體。這可能是問題嗎?
請讓我知道我在這里缺少什么。
uj5u.com熱心網友回復:
- 您需要 package.json 中的啟動腳本。根據您的測驗腳本,它將類似于 -
"start": "node app.js"
查看來自 Google 的示例節點應用程式
- 您正在使用該變數
${hostname},但尚未定義它。您需要定義它并提供一個值,就像您為port
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/516625.html
標籤:Google Cloud Collective 谷歌应用引擎谷歌云平台
上一篇:Recyclerview選擇位置邊框會出現,未選中邊框不出現-如何在AndroidStudio中進行設計,如高亮位置
