Question

I can't build React app with pnpm

Hi, my app keeps crashing at the build stage. I get the following error. Can someone please help me?

[2024-06-11 03:27:00] ╭──────────── git repo clone ───────────╼
[2024-06-11 03:27:00] │  › fetching app source code
[2024-06-11 03:27:00] │ => Selecting branch "develop"
[2024-06-11 03:27:11] │ => Checking out commit "ec7d4d631bd73d12e0a6af55a1083451123e766b"
[2024-06-11 03:27:11] │ 
[2024-06-11 03:27:11] │  ✔ cloned repo to /workspace
[2024-06-11 03:27:11] ╰────────────────────────────────────────╼
[2024-06-11 03:27:11] 
[2024-06-11 03:27:11]  › configuring build-time app environment variables:
[2024-06-11 03:27:11]      GITHUB_CLIENT_ID NEXTAUTH_URL NEXT_PUBLIC_URL GOOGLE_CLIENT_ID GOOGLE_CLIENT_SECRET GITHUB_CLIENT_SECRET NEXTAUTH_SECRET SENTRY_AUTH_TOKEN NEXT_PUBLIC_CLIENT_ID NEXT_PUBLIC_SERVER
[2024-06-11 03:27:11] 
[2024-06-11 03:27:11]  › configuring custom build command to be run at the end of the build:
[2024-06-11 03:27:11]    │ pnpm run build
[2024-06-11 03:27:11] 
[2024-06-11 03:27:12] ╭──────────── buildpack detection ───────────╼
[2024-06-11 03:27:12] │  › using Ubuntu 22.04 stack
[2024-06-11 03:27:12] │ Detected the following buildpacks suitable to build your app:
[2024-06-11 03:27:12] │ 
[2024-06-11 03:27:12] │    heroku/nodejs-engine   v0.5.3  
[2024-06-11 03:27:12] │    digitalocean/node      v0.4.0  (Node.js)
[2024-06-11 03:27:12] │    digitalocean/procfile  v0.0.4  (Procfile)
[2024-06-11 03:27:12] │    digitalocean/custom    v0.1.2  (Custom Build Command)
[2024-06-11 03:27:12] │ 
[2024-06-11 03:27:12] │ For documentation on the buildpacks used to build your app, please see:
[2024-06-11 03:27:12] │ 
[2024-06-11 03:27:12] │    Node.js  v0.4.0  https://do.co/apps-buildpack-node
[2024-06-11 03:27:12] ╰─────────────────────────────────────────────╼
[2024-06-11 03:27:12] 
[2024-06-11 03:27:12] ╭──────────── build caching ───────────╼
[2024-06-11 03:27:12] │  › checking for cache from a previous build
[2024-06-11 03:27:13] │ Layer cache not found
[2024-06-11 03:27:14] │ Layer cache not found
[2024-06-11 03:27:14] ╰───────────────────────────────────────╼
[2024-06-11 03:27:14] 
[2024-06-11 03:27:14] ╭──────────── app build ───────────╼
[2024-06-11 03:27:14] │ ---> Node.js Buildpack
[2024-06-11 03:27:14] │ ---> Installing toolbox
[2024-06-11 03:27:14] │ ---> - jq
[2024-06-11 03:27:15] │ ---> - yj
[2024-06-11 03:27:15] │ ---> Getting Node version
[2024-06-11 03:27:15] │ ---> Resolving Node version
[2024-06-11 03:27:16] │ ---> Downloading and extracting Node v16.20.2
[2024-06-11 03:27:18] │ ---> Parsing package.json
[2024-06-11 03:27:19] │ ---> No file to start server
[2024-06-11 03:27:19] │ ---> either use 'docker run' to start container or add index.js or server.js
[2024-06-11 03:27:19] │ Project contains pnpm-lock.yaml, using pnpm
[2024-06-11 03:27:19] │ Installing node_modules using pnpm (from pnpm-lock.yaml)
[2024-06-11 03:27:19] │ unable to invoke layer creator
[2024-06-11 03:27:19] │ installing node_modules: exec: "pnpm": executable file not found in $PATH
[2024-06-11 03:27:19] │ ERROR: failed to build: exit status 1
[2024-06-11 03:27:19] │ 
[2024-06-11 03:27:19] │ 
[2024-06-11 03:27:19] │ For documentation on the buildpacks used to build your app, please see:
[2024-06-11 03:27:19] │ 
[2024-06-11 03:27:19] │    Node.js  v0.4.0  https://do.co/apps-buildpack-node
[2024-06-11 03:27:19] │ 
[2024-06-11 03:27:19] │  ✘ build failed
[]


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
June 11, 2024

Hey!

This is quite interesting, is your project open-source? If so, would you mind sharing a link to your GitHub repository here so I could take a further look?

But as far as I know DigitalOcean have updated the NodeJS buildpack for the App Platform and the buildpack now supports pnpm.

As long as you have a pnpm-lock.yaml file, this should work out of the box.

What you could is to customize the pnpm version used by specifying the version in the engines section of your package.json:

{
  "engines": {
    "pnpm": "8.14.1"
  }
}

Also, you might want to try to clear your build cache, to do this in the control panel, navigate to your app, click the Actions menu, and then select Force Build and Deploy.

Let me know how it goes!

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more