I’m a using a turporepo setup which contains two apps:
Every time we try to deploy them, we are getting an error associated with yarn
as the node buildpack uses yarn 1.22.22
by default, it suggests we need to run corepack enable
which we have tried to trigger by adding it within the build commands
but still does not work.
How could I fix this issue?
Thanks in advance
[34m › configuring custom build command to be run at the end of the build:[0m
2024-05-19T09:58:00.251744396Z [34m│[0m cd apps/cms
2024-05-19T09:58:00.251758488Z [34m│[0m corepack enable
2024-05-19T09:58:00.252275686Z [34m│[0m yarn build
2024-05-19T09:58:00.252287756Z
2024-05-19T09:58:00.319269293Z [34m╭────────────[34m[30m[44m buildpack detection [0m[0m[34m───────────╼[0m
2024-05-19T09:58:00.335528638Z [34m│[0m [34m › using Ubuntu 22.04 stack[0m
2024-05-19T09:58:00.937937641Z [34m│[0m Detected the following buildpacks suitable to build your app:
2024-05-19T09:58:00.937967914Z [34m│[0m
2024-05-19T09:58:00.937971888Z [34m│[0m heroku/nodejs-engine v1.5.3
2024-05-19T09:58:00.937975398Z [34m│[0m digitalocean/node v0.4.0 (Node.js)
2024-05-19T09:58:00.937978588Z [34m│[0m digitalocean/procfile v0.0.4 (Procfile)
2024-05-19T09:58:00.937982291Z [34m│[0m digitalocean/custom v0.1.2 (Custom Build Command)
2024-05-19T09:58:00.937984310Z [34m│[0m
2024-05-19T09:58:00.937986881Z [34m│[0m For documentation on the buildpacks used to build your app, please see:
2024-05-19T09:58:00.937988833Z [34m│[0m
2024-05-19T09:58:00.937992111Z [34m│[0m Node.js v0.4.0 https://do.co/apps-buildpack-node
2024-05-19T09:58:00.941245295Z [34m╰─────────────────────────────────────────────╼[0m
2024-05-19T09:58:00.941272560Z
2024-05-19T09:58:00.943913257Z [34m╭────────────[34m[30m[44m app build [0m[0m[34m───────────╼[0m
2024-05-19T09:58:00.971002513Z [34m│[0m [INFO] Node.js Buildpack
2024-05-19T09:58:00.973743572Z [34m│[0m [INFO] Setting NODE_ENV to production
2024-05-19T09:58:00.974019490Z [34m│[0m [INFO] Installing toolbox
2024-05-19T09:58:00.975341133Z [34m│[0m [INFO] - yj
2024-05-19T09:58:01.365317427Z [34m│[0m
2024-05-19T09:58:01.365340654Z [34m│[0m [1;35m[Installing Node][0m
2024-05-19T09:58:01.365343219Z [34m│[0m [INFO] Getting Node version
2024-05-19T09:58:01.390950726Z [34m│[0m [INFO] Resolving Node version
2024-05-19T09:58:01.674693837Z [34m│[0m [INFO] Downloading and extracting Node v20.13.1
2024-05-19T09:58:03.095521508Z [34m│[0m
2024-05-19T09:58:03.095565107Z [34m│[0m [1;35m[Parsing package.json][0m
2024-05-19T09:58:03.095568911Z [34m│[0m [INFO] Parsing package.json
2024-05-19T09:58:03.367251774Z [34m│[0m
2024-05-19T09:58:03.367296776Z [34m│[0m [1;35m[Installing yarn][0m
2024-05-19T09:58:03.368738358Z [34m│[0m [INFO] Installing yarn@1.22.22
2024-05-19T09:58:03.554724361Z [34m│[0m [INFO] No file to start server
2024-05-19T09:58:03.554761122Z [34m│[0m [INFO] either use 'docker run' to start container or add index.js or server.js
2024-05-19T09:58:03.572030534Z [34m│[0m Project contains yarn.lock, using yarn
2024-05-19T09:58:03.577958880Z [34m│[0m Installing node_modules using yarn (from yarn.lock)
2024-05-19T09:58:04.029299223Z [34m│[0m Running yarn install
2024-05-19T09:58:04.029609271Z [34m│[0m
2024-05-19T09:58:04.203621219Z [34m│[0m error This project's package.json defines "packageManager": "yarn@4.2.2". However the current global version of Yarn is 1.22.22.
2024-05-19T09:58:04.204084580Z [34m│[0m
2024-05-19T09:58:04.204112465Z [34m│[0m Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
2024-05-19T09:58:04.204119553Z [34m│[0m Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
2024-05-19T09:58:04.214014960Z [34m│[0m
2024-05-19T09:58:04.214331576Z [34m│[0m unable to invoke layer creator
2024-05-19T09:58:04.214342045Z [34m│[0m installing node_modules: exit status 1
2024-05-19T09:58:04.215300753Z [34m│[0m [31;1mERROR: [0mfailed to build: exit status 1
2024-05-19T09:58:04.360091142Z [34m│[0m
2024-05-19T09:58:04.363468533Z [34m│[0m
2024-05-19T09:58:04.363772947Z [34m│[0m For documentation on the buildpacks used to build your app, please see:
2024-05-19T09:58:04.363779161Z [34m│[0m
2024-05-19T09:58:04.363783739Z [34m│[0m Node.js v0.4.0 https://do.co/apps-buildpack-node
2024-05-19T09:58:04.363974840Z [34m│[0m
2024-05-19T09:58:04.373304981Z [34m│[0m [31m ✘ build failed[0m
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!
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.
Hi there,
You can customize the Yarn version used by specifying the version in the
engines
section of yourpackage.json
:As far as I can see the latest version of Yarn is actually
1.22.22
:Have you tried changing the version of yarn in your
packageManager
definition to the latest one to see if it helps?Best,
Bobby