Question

How to upgrade Yarn version

I followed this documentation to specify my Node and Yarn versions in the package.json. I’d like my app to build using Yarn 2+, but when I check the build logs it fails. Does the app platform only support Yarn 1?

Buildpack: buildpack-stack=ubuntu-22

package.json:

"engines": {
        "node": "18.x",
        "yarn": "^4.0.1"
    },

build log:

[2023-12-03 15:06:05] ╭──────────── git repo clone ───────────╼
[2023-12-03 15:06:05] │  › fetching app source code
[2023-12-03 15:06:05] │ => Selecting branch "main"
[2023-12-03 15:06:07] │ => Checking out commit "c5b243c2e69acb46cb2b2a96f77c1bb9ccf4fa15"
[2023-12-03 15:06:07] │ 
[2023-12-03 15:06:07] │  ✔ cloned repo to /workspace
[2023-12-03 15:06:07] ╰────────────────────────────────────────╼
[2023-12-03 15:06:07] 
[2023-12-03 15:06:07]  › configuring build-time app environment variables:
[2023-12-03 15:06:07]      YARN_PRODUCTION FIRESTORE_SERVICE_ACCOUNT AUTH_GITHUB_CLIENT_SECRET LOGGER_GRAFANA_API_KEY AUTH_SUPERTOKENS_API_KEY
[2023-12-03 15:06:07] 
[2023-12-03 15:06:07]  › configuring custom build command to be run at the end of the build:
[2023-12-03 15:06:07]    │ yarn prod:build
[2023-12-03 15:06:07] 
[2023-12-03 15:06:07] ╭──────────── buildpack detection ───────────╼
[2023-12-03 15:06:07] │  › using Ubuntu 22.04 stack
[2023-12-03 15:06:07] │ Detected the following buildpacks suitable to build your app:
[2023-12-03 15:06:07] │ 
[2023-12-03 15:06:07] │    heroku/nodejs-engine   v0.5.2  
[2023-12-03 15:06:07] │    digitalocean/node      v0.3.6  (Node.js)
[2023-12-03 15:06:07] │    digitalocean/procfile  v0.0.4  (Procfile)
[2023-12-03 15:06:07] │    digitalocean/custom    v0.1.2  (Custom Build Command)
[2023-12-03 15:06:07] │ 
[2023-12-03 15:06:07] │ For documentation on the buildpacks used to build your app, please see:
[2023-12-03 15:06:07] │ 
[2023-12-03 15:06:07] │    Node.js  v0.3.6  https://do.co/apps-buildpack-node
[2023-12-03 15:06:07] ╰─────────────────────────────────────────────╼
[2023-12-03 15:06:07] 
[2023-12-03 15:06:07] ╭──────────── app build ───────────╼
[2023-12-03 15:06:07] │ ---> Node.js Buildpack
[2023-12-03 15:06:07] │ ---> Installing toolbox
[2023-12-03 15:06:07] │ ---> - jq
[2023-12-03 15:06:08] │ ---> - yj
[2023-12-03 15:06:09] │ ---> Getting Node version
[2023-12-03 15:06:09] │ ---> Resolving Node version
[2023-12-03 15:06:12] │ ---> Downloading and extracting Node v18.19.0
[2023-12-03 15:06:20] │ ---> Parsing package.json
[2023-12-03 15:06:22] │ 
[2023-12-03 15:06:22] │  ! Yarn v2+ is not supported on this App Platform stack. Please visit our documentation for more information on supported versions and stacks: https://do.co/apps-buildpack-node
[2023-12-03 15:06:22] │ 
[2023-12-03 15:06:22] │ ERROR: failed to build: exit status 1
[2023-12-03 15:06:22] │ 
[2023-12-03 15:06:22] │ 
[2023-12-03 15:06:22] │ For documentation on the buildpacks used to build your app, please see:
[2023-12-03 15:06:22] │ 
[2023-12-03 15:06:22] │    Node.js  v0.3.6  https://do.co/apps-buildpack-node
[2023-12-03 15:06:22] │ 
[2023-12-03 15:06:22] │  ✘ build failed
[]
Show comments

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.

I was facing the same issue (setting the ‘engines’ didn’t work) and created a support ticket. They helped me out! The issue was that the buildpack was ‘stuck’ on an old version, and you need to set an env variable on the component to make it upgrade.

Answer from support:

To upgrade the existing App component to use v0.260.4, you need to set the below environment variable for the component. APP_DISABLE_VERSION_PINNING

APP_DISABLE_VERSION_PINNING=true

After adding the environment variable please do a Force rebuild and deploy. Click on the Actions button in the App UI >> then click Force rebuild and deploy. Make sure to check clear build cache check box.

Hope this helps!

I’m facing the same issue. Did you found any solution?

I was able to solve this by creating a new App with the exact same config, for some reason now it works after adding

  "packageManager": "yarn@4.2.2",
  "engines": {
    "yarn": "4.x"
  },

in package.json

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