netlify / build-image

This is the build image used for running automated builds
MIT License
496 stars 197 forks source link

`NETLIFY_USE_PNPM: true` environment var not working after v4.15.0 #881

Open itsmnthn opened 1 year ago

itsmnthn commented 1 year ago

Is your build failing?

Create pnpm monorepo/workspaces with multiple packages/* individual package doesn't have pnpm-lock.yaml file but root dir does

Describe the bug

Despite of having pnpm-lock.yaml file and NETLIFY_USER_PNPM: true it uses npm to install dependencies

To Reproduce

Steps to reproduce the behavior:

  1. Fork the repository at <repo-link>
  2. Create a Netlify site and link it to the forked repository
  3. See that the Netlify build fails

Configuration

[build]
  base = "./"
  publish = "dist/"
  command = "pnpm build"
  framework = "nuxt3"

[context.production]
  publish = "dist/"
  command = "pnpm build"
  # environment = { }

[build.processing]
  skip_processing = true

[dev]
  framework = "nuxt3"

Expected behavior

It is expected to use pnpm for installation of the dependencies

Build Output

6:34:56 PM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
6:34:56 PM: build-image tag: v4.15.0
6:34:56 PM: buildbot version: 2a5a77f33577e9d9cab7b600772cda180877aa8c
6:34:56 PM: Fetching cached dependencies
6:34:56 PM: Starting to download cache of 419.8MB
6:35:00 PM: Finished downloading cache in 3.92459202s
6:35:00 PM: Starting to extract cache
6:35:05 PM: Finished extracting cache in 4.822619103s
6:35:05 PM: Finished fetching cache in 8.803275103s
6:35:05 PM: Starting to prepare the repo for build
6:35:05 PM: Preparing Git Reference refs/heads/main
6:35:06 PM: Parsing package.json dependencies
6:35:07 PM: Section completed: initializing
6:35:08 PM: Failed to get framework information, continuing with build
6:35:08 PM: Starting build script
6:35:08 PM: Installing dependencies
6:35:08 PM: Python version set to 2.7
6:35:08 PM: Started restoring cached node version
6:35:09 PM: Finished restoring cached node version
6:35:09 PM: Attempting node version '18.12.1' from .nvmrc
6:35:09 PM: v18.12.1 is already installed.
6:35:09 PM: Now using node v18.12.1 (npm v8.19.2)
6:35:09 PM: Enabling node corepack
6:35:09 PM: Started restoring cached build plugins
6:35:09 PM: Finished restoring cached build plugins
6:35:09 PM: Attempting ruby version 2.7.2, read from environment
6:35:10 PM: Using ruby version 2.7.2
6:35:10 PM: Using PHP version 8.0
6:35:10 PM: No npm workspaces detected
6:35:10 PM: Started restoring cached node modules
6:35:10 PM: Finished restoring cached node modules
6:35:10 PM: Installing NPM modules using NPM version 8.19.2
6:35:25 PM: npm ERR! code ERESOLVE
6:35:25 PM: npm ERR! ERESOLVE could not resolve
6:35:25 PM: npm ERR!
6:35:25 PM: npm ERR! While resolving: rxjs@6.6.7
6:35:25 PM: Creating deploy upload records
6:35:25 PM: npm ERR! Found: dev sinon-chai@"2.14.0" from the root project
6:35:25 PM: npm ERR!
6:35:25 PM: npm ERR! Could not resolve dependency:
6:35:25 PM: npm ERR! dev sinon-chai@"2.14.0" from the root project
6:35:25 PM: npm ERR!
6:35:25 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
6:35:25 PM: npm ERR! Fix the upstream dependency conflict, or retry
6:35:25 PM: npm ERR! this command with --force, or --legacy-peer-deps
6:35:25 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
6:35:25 PM: npm ERR!
6:35:25 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
6:35:25 PM: npm ERR! A complete log of this run can be found in:
6:35:25 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-12-06T13_05_11_018Z-debug-0.log
6:35:25 PM: Error during NPM install
6:35:25 PM: Build was terminated: Build script returned non-zero exit code: 1
6:35:25 PM: Failing build: Failed to build site
6:35:25 PM: Finished processing build request in 29.365847973s
lukasholzer commented 1 year ago

@itsmnthn thanks for raising this issue! Can you maybe provide a link to the failed deploy so that we can trouble shoot this better?