Node.js 16 is now generally available.

Running a custom build step

At deployment, before starting your application, you can perform a custom build step by adding a gcp-build script in your package.json file.

When this script is executed, the dependencies in the dependencies and devDependencies fields of your package.json file are available. After executing your custom build step, App Engine removes and regenerates the node_modules folder by only installing the production dependencies declared in the dependencies field of your package.json file.


A custom build script can be used for pre-processing tasks, such as pre-processing CSS, minifying client side JavaScript, or running tools, such as webpack or gulp.

For example, to compile TypeScript to JavaScript, your package.json file might look like the following. Note the gcp-build script:

  "name": "appengine-typescript",
  "description": "An example TypeScript app running on Google App Engine.",
  "version": "0.0.1",
  "private": true,
  "license": "Apache Version 2.0",
  "author": "Google Inc.",
  "engines": {
    "node": "14.x.x"
  "scripts": {
    "prepare": "npm run gcp-build",
    "pretest": "npm run gcp-build",
    "test": "mocha test/*.test.js --exit",
    "posttest": "npm run lint",
    "lint": "tslint -p .",
    "start": "node ./index.js",
    "gcp-build": "tsc -p .",
    "deploy": "gcloud app deploy"
  "dependencies": {
    "@types/node": "^14.14.7",
    "express": "^4.16.3",
    "typescript": "^4.0.0"
  "devDependencies": {
    "mocha": "^9.0.0",
    "wait-port": "^0.2.7",
    "@types/express": "^4.16.0",
    "chai": "^4.2.0",
    "tslint": "^6.0.0",
    "typescript": "^4.0.0"