GoogleCloudPlatform / GoogleCloudPlatform/cloud-builders
[BUG] npm 9.7.0
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 616
- PR merge metrics
- No merged PRs in 30d
Description
## Affected builder image
[eu.gcr.io/gae-runtimes/buildpacks/google-gae-18/nodejs/builder:nodejs_20230529_RC00](http://eu.gcr.io/gae-runtimes/buildpacks/google-gae-18/nodejs/builder:nodejs_20230529_RC00)
## Expected Behavior
My project gets deployed to AppEngine (Node.js 16)
## Actual Behavior
The build aborts with the following:
> Step #2 - "build": === Node.js - Npm (google.nodejs.npm@1.0.0) ===
> Step #2 - "build": 2023/06/01 12:20:37 [DEBUG] GET https://registry.npmjs.org/npm
> Step #2 - "build": --------------------------------------------------------------------------------
> Step #2 - "build": Running "npm install -g --prefix=/layers/google.nodejs.npm/npm npm@9.7.0"
> Step #2 - "build": npm WARN deprecated npm@9.7.0: This release contains incorrect bin entries in its manifest, avoid installing globally
> Step #2 - "build":
> Step #2 - "build": added 1 package, and audited 262 packages in 4s
> Step #2 - "build":
> Step #2 - "build": 27 packages are looking for funding
> Step #2 - "build": run `npm fund` for details
> Step #2 - "build":
> Step #2 - "build": found 0 vulnerabilities
> Step #2 - "build": Done "npm install -g --prefix=/layers/google.nodejs.npm/npm npm@9...." (4.016820088s)
> Step #2 - "build": DEBUG: Setting environment variable PATH=/layers/google.nodejs.npm/npm/bin:/layers/google.nodejs.runtime/node/bin:/builder/google-cloud-sdk/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> Step #2 - "build": --------------------------------------------------------------------------------
> Step #2 - "build": Running "node -v"
> Step #2 - "build": v16.20.0
> Step #2 - "build": Done "node -v" (7.485078ms)
> Step #2 - "build": DEBUG: Current dependency hash: "890cc0e9ce86cf8e36b757e9a2f400e83aa1d424376a41efa1e1413a1c7c9a24"
> Step #2 - "build": DEBUG: Cache dependency hash: "023e5c269ec6eb1908b4f67e29ac35c16bc2052583632ae72fd0f855274e75b4"
> Step #2 - "build": DEBUG: ***** CACHE MISS: "npm_modules"
> Step #2 - "build": Installing application dependencies.
> Step #2 - "build": --------------------------------------------------------------------------------
> Step #2 - "build": Running "node -v"
> Step #2 - "build": v16.20.0
> Step #2 - "build": Done "node -v" (6.319719ms)
> Step #2 - "build": --------------------------------------------------------------------------------
> Step #2 - "build": Running "npm --version"
> Step #2 - "build": node:internal/modules/cjs/loader:1029
> 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 Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)
> Step #2 - "build": at Function.Module._load (node:internal/modules/cjs/loader:871: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:22:47 {
> Step #2 - "build": code: 'MODULE_NOT_FOUND',
> Step #2 - "build": requireStack: []
> Step #2 - "build": }
> Step #2 - "build": Could not determine Node.js install directory
> Step #2 - "build": Done "npm --version" (144.503767ms)
> Step #2 - "build": Failure: (ID: f113d9b7) parsing npm version: Invalid Semantic Version
> Step #2 - "build": --------------------------------------------------------------------------------
> Step #2 - "build": Running "mv -f /builder/outputs/output-448436678784547205 /builder/outputs/output"
> Step #2 - "build": Done "mv -f /builder/outputs/output-448436678784547205 /builder/ou..." (16.633294ms)
> Step #2 - "build": ERROR: failed to build: exit status 1
## Steps to Reproduce the Problem
Update / install any dependency so as to cause a CACHE_MISS, then try to upload. If there is a CACHE_HIT then the error doesn't get triggered.
> Step #2 - "build": DEBUG: Current dependency hash: "890cc0e9ce86cf8e36b757e9a2f400e83aa1d424376a41efa1e1413a1c7c9a24"
> Step #2 - "build": DEBUG: Cache dependency hash: "023e5c269ec6eb1908b4f67e29ac35c16bc2052583632ae72fd0f855274e75b4"
> Step #2 - "build": DEBUG: ***** CACHE MISS: "npm_modules"
## Additional Info
npm 9.7.0 was deprecated a matter of hours after its initial release: https://github.com/npm/cli/releases/tag/v9.7.0
I think you need to rebuild the Cloud Build image with npm 9.6.x to resolve this issue.
Contributor guide
Assessment
This issue has not been assessed yet.