2017-05-08 74 views
0

我剛剛開始使用nodejs和app引擎。我下面教程如何將nodejs代碼從本地機器部署到谷歌應用引擎

https://cloud.google.com/nodejs/tutorials

1)我創建了一個項目,然後克隆nodejs-mvms-quickstart庫。

2)打開Development/source code,打開nodejs-mvms-quickstart/1-hello-world

3),並啓動了節點服務器

npm start 

這是工作的罰款。現在我想從我的本地服務器部署我的nodejs應用程序,而無需複製到github並在服務器上克隆。

對於這個我使用下面的命令

gcloud app deploy 

,但這正顯示出以下錯誤:

If this is your first deployment, this may take a while...done. 

Beginning deployment of service [default]... 
Building and pushing image for service [default] 
WARNING: No node version specified. Please add your node version, see https://docs.npmjs.com/files/package.json#engines 
Some files were skipped. Pass `--verbosity=info` to see which ones. 
You may also view the gcloud log file, found at 
[C:\Users\Sunil Garg\AppData\Roaming\gcloud\logs\2017.05.07\20.38.59.221000.log] 
. 
Started cloud build [1cd2979e-527b-4d68-b430-31471534246e]. 
To see logs in the Cloud Console: https://console.cloud.google.com/gcr/builds/1c 
d2979e-527b-4d68-b430-31471534246e?project=help-coin 
ERROR: gcloud crashed (error): [Errno 10054] An existing connection was forcibly 
closed by the remote host 

If you would like to report this issue,please run the following command: 
    gcloud feedback 

To check gcloud for common problems,please run the following command: 
    gcloud info --run-diagnostics 

這裏是我的package.json

{ 
    "name": "myapp", 
    "version": "1.0.0", 
    "description": "myapp", 
    "main": "index.js", 
    "scripts": { 
    "test": "echo \"Error: no test specified\" && exit 1" 
    }, 
    "repository": { 
    "type": "git", 
    "url": "" 
    }, 
    "author": "", 
    "license": "ISC", 
    "bugs": { 
    "url": "" 
    }, 
    "homepage": "", 
    "dependencies": { 
    "body-parser": "^1.15.0", 
    "connect-timeout": "^1.8.0", 
    "express": "^4.13.4", 
    "generic-pool": "^2.4.2", 
    "multer": "^1.2.0", 
    "mysql": "^2.10.2", 
    "requestify": "^0.1.17" 
    } 
} 

問題是什麼?我錯過了什麼嗎?

+0

你可以發佈你的package.json –

+0

@KalanaDemel更新了我的問題 –

回答

3

嘗試添加以下2個參數到的package.json

添加節點的版本的應用程序是兼容的。

"engines": { 
    "node": "4.6.0" 
    } 

由於您使用npm start你可能需要這個腳本參數,以及因爲NPM開始時調用腳本PARAM在開始陳述命令,根據您的應用程序改變app.js,像node quickstart.js。如果package.json位於根目錄並且.js也位於子目錄中,請務必確保指定路徑。

"scripts": { 
    "start": "node app.js" 
} 
相關問題