Code Guru
Code Guru

Reputation: 15598

How to deploy nodejs code from local machine to google app engine

I have just started with nodejs and app engine. I am following the tutorial

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

1) I have created a project then cloned the nodejs-mvms-quickstart repository.

2) Opened Development/source code and opened the nodejs-mvms-quickstart/1-hello-world

3) and started the node server

npm start

This is working fine. Now I want to deploy my nodejs application from my local server without copying to github and cloning on the server.

For this I am using following command

gcloud app deploy

but this is showing following errors:

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

Here is my 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"
  }
}

What is the issue? Am I missing something?

Upvotes: 0

Views: 399

Answers (1)

Kalana Demel
Kalana Demel

Reputation: 3266

Try adding the following 2 parameters to the package.json

Add the version of node your application is compatible with.

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

since you're using npm start you might need this in the script parameter as well since npm start is calling command stated in start in script param, change app.js according your application, like node quickstart.js. Always make sure to specify the path if your package.json is in the root directory and the .js is in a sub directory as well.

"scripts": {
  "start": "node app.js"
}

Upvotes: 3

Related Questions