Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to deploy to App Egnine - nodejs build problem

I have not changed the app.yaml deployment config. It worked without a problem since yesterday. I get the following build error when i deploy. Just in case to check if this is a problem on my end, I have created a new project in Google Cloud and a new nodejs project. However, I get the same build error when i deploy to App Engine.  Please if anyone can help me find an alternative fix so that I can deploy my features would be greatly appreciated.

Step #2 - "build": Running "node -v"
Step #2 - "build": v18.16.0
Step #2 - "build": Done "node -v" (12.416297ms)
Step #2 - "build": DEBUG: Current dependency hash: "0167fd0e301ab851cebce3162b5fd067c8feec8d7f4ce651c4a2f235b3b3282e"
Step #2 - "build": DEBUG: Cache dependency hash: ""
Step #2 - "build": DEBUG: No metadata found from a previous build, skipping cache.
Step #2 - "build": DEBUG: ***** CACHE MISS: "npm_modules"
Step #2 - "build": Installing application dependencies.
Step #2 - "build": --------------------------------------------------------------------------------
Step #2 - "build": Running "npm --version"
Step #2 - "build": node:internal/modules/cjs/loader:1078
Step #2 - "build": throw err;
Step #2 - "build": ^
Step #2 - "build":
Step #2 - "build": Error: Cannot find module '/layers/google.nodejs.runtime/node/bin/node_modules/npm/bin/npm-cli.js'
Step #2 - "build": at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
Step #2 - "build": at Module._load (node:internal/modules/cjs/loader:920:27)
Step #2 - "build": at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
Step #2 - "build": at node:internal/main/run_main_module:23:47 {
Step #2 - "build": code: 'MODULE_NOT_FOUND',
Step #2 - "build": requireStack: []
Step #2 - "build": }
Step #2 - "build":
Step #2 - "build": Node.js v18.16.0
Step #2 - "build": Could not determine Node.js install directory
Step #2 - "build": Done "npm --version" (149.604027ms)
Step #2 - "build": Failure: (ID: f113d9b7) parsing npm version: Invalid Semantic Version
Step #2 - "build": --------------------------------------------------------------------------------
Step #2 - "build": Running "mv -f /builder/outputs/output-2034946547071661575 /builder/outputs/output"
Step #2 - "build": Done "mv -f /builder/outputs/output-2034946547071661575 /builder/o..." (19.055247ms)
Step #2 - "build": ERROR: failed to build: exit status 1
Finished Step #2 - "build"
ERROR
ERROR: build step 2 "asia.gcr.io/gae-runtimes/buildpacks/google-gae-22/nodejs/builder:nodejs_20230529_RC00" failed: step exited with non-zero status: 51
----------------------------------------------------------------------------------------------------------------------

 
Solved Solved
1 4 3,067
1 ACCEPTED SOLUTION

Hi @fangeater,

Welcome to the Google Cloud Community!

You can try the following troubleshooting options:

  1. Specify a different Node.js version by configuring the engines.node field in your package.json. You can read more about Specifying versions of Node.js.
  2. Install dependencies by looking into this documentation. You can also try running "npm install".
  3. You can also get in touch with Google Cloud Support if the above options don't work.

Let me know if it helped, thanks!

View solution in original post

4 REPLIES 4

Hi @fangeater,

Welcome to the Google Cloud Community!

You can try the following troubleshooting options:

  1. Specify a different Node.js version by configuring the engines.node field in your package.json. You can read more about Specifying versions of Node.js.
  2. Install dependencies by looking into this documentation. You can also try running "npm install".
  3. You can also get in touch with Google Cloud Support if the above options don't work.

Let me know if it helped, thanks!

modifying my original engines.node did the trick! Thank you 🙂

Hi @fangeater could you please give more details about what you did?

For anyone who is facing this issue. It seems there is a compatibility error with latest version of npm (9.7.0)

To solve it add or edit the engine for npm in your package.json

{

    ...

    "engines": {
       ...
       "npm": ">=6.0.0 <=9.6.7",
       ...
    },
}