[英]How to deploy nodejs code from local machine to google app engine
我刚刚开始使用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"
}
}
有什么问题 我想念什么吗?
尝试将以下2个参数添加到package.json
添加您的应用程序兼容的节点版本。
"engines": {
"node": "4.6.0"
}
由于您使用的是npm start
,因此在脚本参数中可能也需要此参数,因为npm start正在调用脚本参数start中声明的命令,因此请根据您的应用程序更改app.js
,例如node quickstart.js
。 如果package.json位于根目录中,而.js
也位于子目录中,请始终确保指定路径。
"scripts": {
"start": "node app.js"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.