Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm 9.7.0 #922

Open
JohnGale87 opened this issue Jun 1, 2023 · 2 comments
Open

[BUG] npm 9.7.0 #922

JohnGale87 opened this issue Jun 1, 2023 · 2 comments
Labels

Comments

@JohnGale87
Copy link

Affected builder image

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.

@JohnGale87 JohnGale87 added the bug label Jun 1, 2023
@JohnGale87 JohnGale87 changed the title [BUG] [BUG] npm 9.7.0 Jun 1, 2023
@JohnGale87
Copy link
Author

@zendranm
Copy link

zendranm commented Jun 7, 2023

For anyone looking for a workaround, restricting the npm version in the project helped:

 "engines": {
    "npm": ">=8 <9.7"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants