我刚开始使用nodejs和app引擎。我正在按照教程
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 :(得分:3)
尝试将以下2个参数添加到package.json
添加与您的应用程序兼容的节点版本。
"engines": {
"node": "4.6.0"
}
因为你正在使用npm start
,所以你也可能需要在script参数中使用它,因为npm start是在脚本参数的start中调用命令,根据你的应用改变app.js
,如{{1 }}。如果package.json位于根目录中,并且node quickstart.js
也位于子目录中,请始终确保指定路径。
.js