Closed paulm17 closed 2 years ago
Right now, when doing an installation it defaults to yarn 1.
As far as I know, npx create-turbo@latest
will prompt you to select the package manager you want to use. What turbo command are you using that is using Yarn 1 by default?
I had a lot of issues getting here and I must have forgotten a step / mis-remembering my history.
Going back and trying again. I am getting with yarn v3 initially:
paul@Pauls-MacBook-Pro tempo2 % yarn -v
1.22.19
paul@Pauls-MacBook-Pro tempo2 % yarn set version stable
➤ YN0000: Retrieving https://repo.yarnpkg.com/3.2.4/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-3.2.4.cjs
➤ YN0000: Done in 0s 279ms
paul@Pauls-MacBook-Pro tempo2 % npx create-turbo@latest
>>> TURBOREPO
>>> Welcome to Turborepo! Let's get you set up with a new codebase.
? Where would you like to create your turborepo? myturborepo
? Which package manager do you want to use? yarn
>>> Created a new turborepo with the following:
- apps/web: Next.js with TypeScript
- apps/docs: Next.js with TypeScript
- packages/ui: Shared React component library
- packages/eslint-config-custom: Shared configuration (ESLint)
- packages/tsconfig: Shared TypeScript `tsconfig.json`
>> Installing dependencies...
Aborting installation.
yarn install --no-immutable has failed.
It doesn't install even if I go into the newly created turborepo dir and execute the same yarn command.
Now I remember:
When I upgrade the yarn to version 3, it creates a package.json. If I set the install dir to ./ then it installs fine.
paul@Pauls-MacBook-Pro tempo2 % cd myturborepo
paul@Pauls-MacBook-Pro myturborepo % yarn set version stable
➤ YN0000: Retrieving https://repo.yarnpkg.com/3.2.4/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-3.2.4.cjs
➤ YN0000: Done in 0s 310ms
paul@Pauls-MacBook-Pro myturborepo % ls
package.json
paul@Pauls-MacBook-Pro myturborepo % npx create-turbo@latest
>>> TURBOREPO
>>> Welcome to Turborepo! Let's get you set up with a new codebase.
? Where would you like to create your turborepo? ./
? Which package manager do you want to use? yarn
>>> Created a new turborepo with the following:
- apps/web: Next.js with TypeScript
- apps/docs: Next.js with TypeScript
- packages/ui: Shared React component library
- packages/eslint-config-custom: Shared configuration (ESLint)
- packages/tsconfig: Shared TypeScript `tsconfig.json`
>>> Success! Your new Turborepo is ready.
Inside this directory, you can run several commands:
yarn run build
Build all apps and packages
yarn run dev
Develop all apps and packages
Turborepo will cache locally by default. For an additional
speed boost, enable Remote Caching with Vercel by
entering the following command:
yarn dlx turbo login
We suggest that you begin by typing:
yarn dlx turbo login
Sorry to move the goal posts slightly.
Here's what I'm using:
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Pro
Memory: 804.28 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.4.0
Yarn: 3.2.4
npm: 8.12.1
Found it:
.yarnrc.yml has the following
yarnPath: .yarn/releases/yarn-3.2.4.cjs
After an install, only the following
nodeLinker: "node-modules"
Of which yarn goes back to v1.
I don't know how to set yarn globally to v3, so that's the source of my issue.
I'm solving this by fixing this issue myself currently.
Thanks for your attention on this. But I have abandoned Yarn v3.
The final nail was that for whatever reason, the node_modules directory in UI could not be re-created when using certain packages. It was fine with the initial package.json, but when I use my existing yarn v1 package.json, yarn complains about missing dependencies, finishes but no directory.
After many issues, I've had enough.
I noticed a couple things:
When I run yarn set version stable
in the parent directory, it creates a package.json
, .yarn/
and .yarnrc.yml
file. This causes yarn install
to fail in the new turborepo.
pwd //=> ~/dev
yarn set version stable
npx create-turbo@latest // fails on install step
If I remove those new yarn files, install works.
I'm not sure if this is something turbo needs to watch out for, since I'm not sure what other ways the yarn
version can be set globally 🤔.
Thanks for your attention on this. But I have abandoned Yarn v3.
Sorry to hear! I'm no expert in yarn, but if you figure out how create-turbo
can set you up with Yarn better, I'd love to hear about it.
If you run yarn --version
in your current directory and it returns, say, 3.2.3
we will initialize a yarn@3 turborepo with the correct configuration. One way you can do that is to use corepack
:
~$ corepack enable
~$ corepack prepare yarn@3.x --activate
Preparing yarn@3.x for immediate activation...
~$ yarn --version
3.2.3
~$ yarn create turbo --use-yarn issue-2250
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 3s 982ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done in 4s 136ms
>>> TURBOREPO
>>> Welcome to Turborepo! Let's get you set up with a new codebase.
>>> Created a new turborepo with the following:
- apps/web: Next.js with TypeScript
- apps/docs: Next.js with TypeScript
- packages/ui: Shared React component library
- packages/eslint-config-custom: Shared configuration (ESLint)
- packages/tsconfig: Shared TypeScript `tsconfig.json`
>>> Success! Created a new Turborepo at "issue-2250".
Inside that directory, you can run several commands:
yarn run build
Build all apps and packages
yarn run dev
Develop all apps and packages
Turborepo will cache locally by default. For an additional
speed boost, enable Remote Caching with Vercel by
entering the following command:
yarn dlx turbo login
We suggest that you begin by typing:
cd issue-2250
yarn dlx turbo login
Describe the feature you'd like to request
Right now, when doing an installation it defaults to yarn 1.
It would be nice, if the dev is using the latest yarn, then npx create-turbo@latest should use it. Otherwise:
1) Install turborepo. Yarn 1 used. 2) Upgrade yarn:
3) Run Yarn again:
As then workspaces can be run:
Or else:
Describe the solution you'd like
npx create-turbo@latest uses the currently used version.
Describe alternatives you've considered
See above.