I’m running into build issues since January 8th. Here is an example of a failed build:
1:44:24 PM: build-image version: a2d22d22e4555d1ef0a972ed14a0a4b366ad20c4 (focal)
1:44:24 PM: build-image tag: v4.16.3
1:44:24 PM: buildbot version: 4033cea21a3d9a6b51a0c8660e8b7502a7f7abfe
1:44:24 PM: Fetching cached dependencies
1:44:24 PM: Starting to download cache of 1.5GB
1:44:38 PM: Finished downloading cache in 13.583314949s
1:44:38 PM: Starting to extract cache
1:44:47 PM: Finished extracting cache in 8.861643961s
1:44:47 PM: Finished fetching cache in 22.564893012s
1:44:47 PM: Starting to prepare the repo for build
1:44:47 PM: Preparing Git Reference refs/heads/main
1:44:49 PM: Parsing package.json dependencies
1:44:50 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'docs/build' versus 'build' in the Netlify UI
1:44:50 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF .'
1:44:50 PM: Failed to get framework information, continuing with build
1:44:50 PM: Starting build script
1:44:50 PM: Installing dependencies
1:44:50 PM: Python version set to 2.7
1:44:50 PM: Started restoring cached Node.js version
1:44:51 PM: Finished restoring cached Node.js version
1:44:51 PM: v16.19.0 is already installed.
1:44:51 PM: Now using node v16.19.0 (npm v8.19.3)
1:44:51 PM: Enabling Node.js Corepack
1:44:52 PM: Started restoring cached build plugins
1:44:52 PM: Finished restoring cached build plugins
1:44:52 PM: Attempting Ruby version 2.7.2, read from environment
1:44:52 PM: Using Ruby version 2.7.2
1:44:52 PM: Using PHP version 8.0
1:44:52 PM: Started restoring cached corepack dependencies
1:44:52 PM: mv: cannot move '/opt/build/cache/.node/corepack' to '/opt/buildhome/.node/corepack': No such file or directory
1:44:52 PM: Finished restoring cached corepack dependencies
1:44:52 PM: jq: error (at <stdin>:1): Cannot iterate over null (null)
1:44:52 PM: No npm workspaces detected
1:44:52 PM: Started restoring cached node modules
1:44:52 PM: Finished restoring cached node modules
1:44:52 PM: Bypassing sha validation. Running pre & post install scripts
1:44:53 PM: Installing npm packages using npm version 8.19.3
1:44:55 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
1:44:55 PM: npm ERR! code EUNSUPPORTEDPROTOCOL
1:44:55 PM: npm ERR! Unsupported URL Type "workspace:": workspace:*
1:44:55 PM: npm ERR! A complete log of this run can be found in:
1:44:55 PM: npm ERR! /opt/buildhome/.npm/_logs/2023-01-16T18_44_53_361Z-debug-0.log
1:44:55 PM: Error during npm install
1:44:55 PM: Build was terminated: Build script returned non-zero exit code: 1
1:44:55 PM: Failing build: Failed to build site
1:44:55 PM: Finished processing build request in 31.352432279s
I’m using pnpm, thus the workspace: * syntax.
It looks like this line:
Now using node v16.19.0 (npm v8.19.3)
Implies that Netlify is using npm, when it should be using pnpm. According to this page (How to use pnpm with Netlify Build | Netlify Blog) the presence of a pnpm-lock.yaml file is all that’s needed to enable pnpm. Is there something else I should be doing?
My last successful build was commit 869cc4d1403ce363e9fa392a8805dbc6e9a3350b. The following two builds (825100d and ea237d6) were canceled. Commit fe41e7a failed. None of the three canceled or failed commits contain any changes related to the workspace or netlify configuration:
Thanks so much for reaching out and welcome to the Netlify Forums. First, have you looked through this resource 7? It is a compilation of all of our build and deploy resources. This is a good starting point.
If those resources don’t get you on the right track, can you share a bit more information about what you are trying to accomplish?
Lastly, please share these additional details so we can look into your experience further:
your project repo
a full copy of your latest deploy log
what you have already tried
any error messages you have received in your terminal window or in the developer console
If your build works locally, the next debugging step is to ensure the package versions we use to build match the ones you use in your own development environment. You can find the settings for these in our Build Settings doc. That’s the leading cause of build failures.
I’m pretty sure that the package manager is different, as the logs above indicate Netlify is using npm, and it should be using pnpm. I don’t see anything in the linked documentation that discusses pnpm, and I’m not sure where else that workspace:* error in the logs would be coming from.
I’ve read through the rest of the documentation and can’t seem to find anything that matches the error I’m seeing.
I reran the build with debug mode on. Here’s the logs:
7:29:23 PM: build-image version: a2d22d22e4555d1ef0a972ed14a0a4b366ad20c4 (focal)
7:29:23 PM: build-image tag: v4.16.3
7:29:23 PM: buildbot version: 3bd65547ad0cc7e555b4d091bb1e3da5ef545973
7:29:23 PM: Fetching cached dependencies
7:29:23 PM: Starting to download cache of 1.5GB
7:29:39 PM: Finished downloading cache in 15.78378204s
7:29:39 PM: Starting to extract cache
7:29:51 PM: Finished extracting cache in 11.296960307s
7:29:51 PM: Finished fetching cache in 27.232094429s
7:29:51 PM: Starting to prepare the repo for build
7:29:51 PM: Preparing Git Reference refs/heads/main
7:29:52 PM: Parsing package.json dependencies
7:29:53 PM:
❯ Initial build environment
baseRelDir: true
branch: main
context: production
cwd: /opt/build/repo
featureFlags: []
mode: buildbot
repositoryRoot: /opt/build/repo
siteId: 9d17b951-1726-4bb0-b2f1-c21b69b0dd00
❯ UI build settings
baseRelDir: true
build:
base: docs
command: pnpm run build
environment:
- NETLIFY_BUILD_DEBUG
publish: build
❯ Resolved build environment
branch: main
buildDir: /opt/build/repo/docs
configPath: /opt/build/repo/netlify.toml
context: production
env: []
❯ Resolved config
build:
base: /opt/build/repo/docs
command: pnpm run build
commandOrigin: config
environment:
- NETLIFY_BUILD_DEBUG
ignore: git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF .
publish: /opt/build/repo/docs/build
publishOrigin: config
7:29:53 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'docs/build' versus 'build' in the Netlify UI
7:29:53 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF .'
7:29:54 PM: Failed to get framework information, continuing with build
7:29:54 PM: Starting build script
7:29:54 PM: Installing dependencies
7:29:54 PM: Python version set to 2.7
7:29:54 PM: Started restoring cached Node.js version
7:29:55 PM: Finished restoring cached Node.js version
7:29:55 PM: v16.19.0 is already installed.
7:29:56 PM: Now using node v16.19.0 (npm v8.19.3)
7:29:56 PM: Enabling Node.js Corepack
7:29:56 PM: Started restoring cached build plugins
7:29:56 PM: Finished restoring cached build plugins
7:29:56 PM: Attempting Ruby version 2.7.2, read from environment
7:29:57 PM: Using Ruby version 2.7.2
7:29:57 PM: Using PHP version 8.0
7:29:57 PM: Started restoring cached corepack dependencies
7:29:57 PM: mv: cannot move '/opt/build/cache/.node/corepack' to '/opt/buildhome/.node/corepack': No such file or directory
7:29:57 PM: Finished restoring cached corepack dependencies
7:29:57 PM: jq: error (at <stdin>:1): Cannot iterate over null (null)
7:29:57 PM: No npm workspaces detected
7:29:57 PM: Started restoring cached node modules
7:29:57 PM: Finished restoring cached node modules
7:29:57 PM: Bypassing sha validation. Running pre & post install scripts
7:29:57 PM: Installing npm packages using npm version 8.19.3
7:30:00 PM: npm ERR! code EUNSUPPORTEDPROTOCOL
7:30:00 PM: npm ERR! Unsupported URL Type "workspace:": workspace:*
7:30:00 PM: npm ERR! A complete log of this run can be found in:
7:30:00 PM: npm ERR! /opt/buildhome/.npm/_logs/2023-01-18T00_29_58_111Z-debug-0.log
7:30:00 PM: Error during npm install
7:30:00 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
7:30:00 PM: Build was terminated: Build script returned non-zero exit code: 1
7:30:00 PM: Failing build: Failed to build site
7:30:00 PM: Finished processing build request in 37.087281569s
The line Error during npm install certainly seems to indicate that npm is being used, despite the presence of a pnpm-lock.yaml file.
Old workarounds are no longer needed
Prior to this change, it was possible to use pnpm with Netlify but it required workarounds. Developers found various methods to make pnpm work, some of which required disabling npm.
As of January 8th my builds stopped working, but reverting to this workaround and manually disabling npm results in a successful build. My netlify.toml now looks like:
[build]
base = "docs/"
command = "pnpm run build"
publish = "build/"
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ."
Welcome back to the forums, thanks so much for sharing this with the community. This will help others who stumbled upon this post. Glad to hear your build is working as intended.