gluestack-ui: Error: Command failed: yarn config set legacy-peer-deps true

Description

Trying to initialize a new project with gluestack-ui and Yarn 4.x errors out

CodeSandbox/Snack link

N/A

Steps to reproduce

yarn init
yarn set version 4.5.1
yarn dlx gluestack-ui@latest init

gluestack-ui Version

latest

Platform

  • Expo
  • React Native CLI
  • Next
  • Web
  • Android
  • iOS

Other Platform

No response

Additional Information

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 12
  • Comments: 26 (2 by maintainers)

Most upvoted comments

Please help us.

You’re a software developer, use your problem solving skills… All I did was init a project with npm, and copy over all the components and deps. If you can’t sort that out, you can pay the Gluestack team to help you. Them offering this fantastic library for free is help enough.

Off point man

“npx gluestack-ui@latest init” just flat out does not work with yarn 2+ because of this. “classic” yarn is super old by now. Is this going to be fixed?

Hi everyone,

@FezVrasta

Here’s a workaround I managed to get working for me. I recently installed Glue for a new project and ran into an error. My setup is:

    "react": "19.0.0",
    "react-native": "0.78.0",

Using .yarn/releases/yarn-3.6.4.cjs

  1. Created a new file called .npmrc and added the following line: legacy-peer-deps=true

Yes, I know I’m using .yarnrc and .npmrc together, but it was necessary in this case.

  1. Deleted the yarn.lock file.

  2. Run the Glue initialisation command:

npx gluestack-ui init

After this, you’ll be prompted to select a package manager:

No lockfile detected. Please select a package manager to install dependencies: In my case, I selected yarn for my local project configuration.

Then, you’ll be prompted again:

No lockfile detected. Please select a package manager to install dependencies: This time, choosenpmso that it picks up the CLI configuration and doesn’t conflict with legacy-peer-deps=true.

Then, wait for Glue to install.

Once it finishes the entire configuration, remove package-json.lock and run yarn install again.

I hope this workaround helps!

we will look into it, test and then update the cli.

thank you for reporting 😄

Is there any progress? we’re delaying our migration to gluestack-ui v2 since we’re using yarn v4

I can use gluestack-ui version 0.7.13 when add component.

  1. init gluestack-ui lastest version. yarn dlx gluestack-ui@latest init

  2. use version 0.7.13 to add component yarn dlx gluestack-ui@0.7.13 add ...

It works for me. Hope It helps you.

I just noticed the same happens when I try to add any component.

CleanShot 2024-11-06 at 4  25 45@2x