vercel / turbo

Incremental bundler and build system optimized for JavaScript and TypeScript, written in Rust – including Turbopack and Turborepo.
https://turbo.build
MIT License
25.61k stars 1.74k forks source link

Differing Yarn versions with `create-turbo` #8406

Open angel-luis opened 1 month ago

angel-luis commented 1 month ago

Verify canary release

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac

Describe the Bug

yarn dlx create-turbo@canary test-turbo-canary ➤ YN0000: · Yarn 4.2.2 ➤ YN0000: ┌ Resolution step ➤ YN0085: │ + create-turbo@npm:2.0.3-canary.0, @tootallnate/quickjs-emscripten@npm:0.23.0, and 104 more. ➤ YN0000: └ Completed in 1s 457ms ➤ YN0000: ┌ Fetch step ➤ YN0013: │ 106 packages were added to the project (+ 13.68 MiB). ➤ YN0000: └ Completed ➤ YN0000: ┌ Link step ➤ YN0000: └ Completed ➤ YN0000: · Done in 1s 583ms

TURBOREPO

Welcome to Turborepo! Let's get you set up with a new codebase.

? Which package manager do you want to use? yarn workspaces

Downloading files. This might take a moment.

Created a new Turborepo with the following:

apps

Installing packages. This might take a couple of minutes.

Installing dependencies...

Unexpected error. Please report it as a bug: Error: Command failed with exit code 1: yarn install warning workspace-aggregator-02bbff1e-c07a-4fed-8f61-7993e830add9 > docs > eslint > @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead warning workspace-aggregator-02bbff1e-c07a-4fed-8f61-7993e830add9 > docs > eslint > @humanwhocodes/config-array > @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead warning workspace-aggregator-02bbff1e-c07a-4fed-8f61-7993e830add9 > @repo/ui > @turbo/gen > node-plop > globby > glob@7.2.3: Glob versions prior to v9 are no longer supported warning workspace-aggregator-02bbff1e-c07a-4fed-8f61-7993e830add9 > docs > eslint > file-entry-cache > flat-cache > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported warning workspace-aggregator-02bbff1e-c07a-4fed-8f61-7993e830add9 > @repo/ui > @turbo/gen > @turbo/workspaces > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported warning workspace-aggregator-02bbff1e-c07a-4fed-8f61-7993e830add9 > @repo/ui > @turbo/gen > node-plop > del > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported warning workspace-aggregator-02bbff1e-c07a-4fed-8f61-7993e830add9 > docs > eslint > file-entry-cache > flat-cache > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported warning workspace-aggregator-02bbff1e-c07a-4fed-8f61-7993e830add9 > @repo/ui > @turbo/gen > node-plop > globby > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. warning sharp@0.33.4: The engine "libvips" appears to be invalid. warning @img/sharp-darwin-arm64@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-darwin-arm64@0.33.4: The engine "glibc" appears to be invalid. warning @img/sharp-darwin-x64@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-darwin-x64@0.33.4: The engine "glibc" appears to be invalid. warning @img/sharp-libvips-linux-arm@1.0.2: The engine "pnpm" appears to be invalid. warning @img/sharp-libvips-linux-arm@1.0.2: The engine "glibc" appears to be invalid. warning @img/sharp-libvips-darwin-arm64@1.0.2: The engine "pnpm" appears to be invalid. warning @img/sharp-libvips-darwin-arm64@1.0.2: The engine "macos" appears to be invalid. warning @img/sharp-libvips-darwin-x64@1.0.2: The engine "pnpm" appears to be invalid. warning @img/sharp-libvips-darwin-x64@1.0.2: The engine "macos" appears to be invalid. warning @img/sharp-libvips-linux-x64@1.0.2: The engine "pnpm" appears to be invalid. warning @img/sharp-libvips-linux-x64@1.0.2: The engine "glibc" appears to be invalid. warning @img/sharp-libvips-linuxmusl-x64@1.0.2: The engine "pnpm" appears to be invalid. warning @img/sharp-libvips-linuxmusl-x64@1.0.2: The engine "musl" appears to be invalid. warning @img/sharp-linux-x64@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-linux-x64@0.33.4: The engine "glibc" appears to be invalid. warning @img/sharp-linuxmusl-arm64@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-linuxmusl-arm64@0.33.4: The engine "musl" appears to be invalid. warning @img/sharp-linuxmusl-x64@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-linuxmusl-x64@0.33.4: The engine "musl" appears to be invalid. warning @img/sharp-win32-ia32@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-wasm32@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-win32-x64@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-libvips-linux-s390x@1.0.2: The engine "pnpm" appears to be invalid. warning @img/sharp-libvips-linux-s390x@1.0.2: The engine "glibc" appears to be invalid. warning @img/sharp-libvips-linuxmusl-arm64@1.0.2: The engine "pnpm" appears to be invalid. warning @img/sharp-libvips-linuxmusl-arm64@1.0.2: The engine "musl" appears to be invalid. warning @img/sharp-linux-s390x@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-linux-s390x@0.33.4: The engine "glibc" appears to be invalid. warning @img/sharp-libvips-linux-arm64@1.0.2: The engine "pnpm" appears to be invalid. warning @img/sharp-libvips-linux-arm64@1.0.2: The engine "glibc" appears to be invalid. warning @img/sharp-linux-arm@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-linux-arm@0.33.4: The engine "glibc" appears to be invalid. warning @img/sharp-linux-arm64@0.33.4: The engine "pnpm" appears to be invalid. warning @img/sharp-linux-arm64@0.33.4: The engine "glibc" appears to be invalid. warning "@repo/eslint-config > eslint-config-prettier@9.1.0" has unmet peer dependency "eslint@>=7.0.0". warning "@repo/eslint-config > eslint-config-turbo@2.0.3" has unmet peer dependency "eslint@>6.6.0". warning "@repo/eslint-config > eslint-config-turbo > eslint-plugin-turbo@2.0.3" has unmet peer dependency "eslint@>6.6.0". warning "@repo/eslint-config > @vercel/style-guide > @babel/eslint-parser@7.24.7" has unmet peer dependency "eslint@^7.5.0 || ^8.0.0 || ^9.0.0". warning "@repo/eslint-config > @vercel/style-guide > eslint-import-resolver-typescript@3.6.1" has unmet peer dependency "eslint@*". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-eslint-comments@3.2.0" has unmet peer dependency "eslint@>=4.19.1". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-jest@27.9.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-jsx-a11y@6.8.0" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-import@2.29.1" has unmet peer dependency "eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-playwright@0.16.0" has unmet peer dependency "eslint@>=7". warning "@repo/eslint-config > @typescript-eslint/parser@7.12.0" has unmet peer dependency "eslint@^8.56.0". warning "@repo/eslint-config > @vercel/style-guide > @typescript-eslint/parser@6.21.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-react@7.34.2" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-testing-library@6.2.2" has unmet peer dependency "eslint@^7.5.0 || ^8.0.0". warning "@repo/eslint-config > @typescript-eslint/eslint-plugin@7.12.0" has unmet peer dependency "eslint@^8.56.0". warning "@repo/eslint-config > @vercel/style-guide > @typescript-eslint/eslint-plugin@6.21.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-unicorn@48.0.1" has unmet peer dependency "eslint@>=8.44.0". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-react-hooks@4.6.2" has unmet peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-jest > @typescript-eslint/utils@5.62.0" has unmet peer dependency "eslint@^6.0.0 || ^7.0.0 || ^8.0.0". warning "@repo/eslint-config > @typescript-eslint/eslint-plugin > @typescript-eslint/utils@7.12.0" has unmet peer dependency "eslint@^8.56.0". warning "@repo/eslint-config > @vercel/style-guide > @typescript-eslint/eslint-plugin > @typescript-eslint/utils@6.21.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning "@repo/eslint-config > @vercel/style-guide > eslint-plugin-unicorn > @eslint-community/eslint-utils@4.4.0" has unmet peer dependency "eslint@^6.0.0 || ^7.0.0 || >=8.0.0". warning "@repo/eslint-config > @typescript-eslint/eslint-plugin > @typescript-eslint/type-utils@7.12.0" has unmet peer dependency "eslint@^8.56.0". warning "@repo/eslint-config > @vercel/style-guide > @typescript-eslint/eslint-plugin > @typescript-eslint/type-utils@6.21.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning Error running install script for optional dependency: "/Users/angelluis/Repos/Learn/sina/test-turbo-canary/node_modules/sharp: Cannot find module 'pnpapi' Require stack:

  • /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/lib/cli.js
  • /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/bin/yarn.js Require stack:
  • /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/lib/cli.js
  • /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/bin/yarn.js" error Error: /Users/angelluis/Repos/Learn/sina/test-turbo-canary/node_modules/core-js-pure: Cannot find module 'pnpapi' Require stack:
  • /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/lib/cli.js
  • /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/bin/yarn.js Require stack:
  • /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/lib/cli.js
  • /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/bin/yarn.js at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15) at require$$0.Module._resolveFilename (/private/var/folders/70/x1_phbj50v7d91p22wfkx4b40000gn/T/e5a74f8e86cd01ca3594ce43bc82f10d.cjs:6680:54) at require.resolve (/Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/lib/v8-compile-cache.js:162:23) at /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/lib/cli.js:34245:76 at Generator.next () at step (/Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/lib/cli.js:310:30) at /Users/angelluis/.cache/node/corepack/v1/yarn/1.22.22/lib/cli.js:321:13 yarn install v1.22.22 info No lockfile found. [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... [4/5] Linking dependencies... [5/5] Building fresh packages... info This module is OPTIONAL, you can safely ignore this error info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. at QB (/private/var/folders/70/x1_phbj50v7d91p22wfkx4b40000gn/T/xfs-e8b3fd8e/dlx-66427/.yarn/cache/create-turbo-npm-2.0.3-canary.0-683a4de2c0-4c9b107cf4.zip/node_modules/create-turbo/dist/cli.js:12:57) at /private/var/folders/70/x1_phbj50v7d91p22wfkx4b40000gn/T/xfs-e8b3fd8e/dlx-66427/.yarn/cache/create-turbo-npm-2.0.3-canary.0-683a4de2c0-4c9b107cf4.zip/node_modules/create-turbo/dist/cli.js:12:8077 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Fl (/private/var/folders/70/x1_phbj50v7d91p22wfkx4b40000gn/T/xfs-e8b3fd8e/dlx-66427/.yarn/cache/create-turbo-npm-2.0.3-canary.0-683a4de2c0-4c9b107cf4.zip/node_modules/create-turbo/dist/cli.js:60:2092) at async Command.y0 (/private/var/folders/70/x1_phbj50v7d91p22wfkx4b40000gn/T/xfs-e8b3fd8e/dlx-66427/.yarn/cache/create-turbo-npm-2.0.3-canary.0-683a4de2c0-4c9b107cf4.zip/node_modules/create-turbo/dist/cli.js:87:2101) at async Command.parseAsync (/private/var/folders/70/x1_phbj50v7d91p22wfkx4b40000gn/T/xfs-e8b3fd8e/dlx-66427/.yarn/cache/commander-npm-11.1.0-56e979613c-13cc6ac875.zip/node_modules/commander/lib/command.js:936:5)

To Reproduce

yarn dlx create-turbo@latest or yarn dlx create-turbo@canary

node v20.14.0 yarn v1.22.22

anthonyshew commented 1 month ago

It looks like yarn versions are stepping on each other. You're mentioning that you're using yarn v1 but this log is from Yarn v4:

yarn dlx create-turbo@canary test-turbo-canary ➤ YN0000: · Yarn 4.2.2 ➤ YN0000: ┌ Resolution step ➤ YN0085: │ + create-turbo@npm:2.0.3-canary.0, @tootallnate/quickjs-emscripten@npm:0.23.0, and 104 more. ➤ YN0000: └ Completed in 1s 457ms ➤ YN0000: ┌ Fetch step ➤ YN0013: │ 106 packages were added to the project (+ 13.68 MiB). ➤ YN0000: └ Completed ➤ YN0000: ┌ Link step ➤ YN0000: └ Completed ➤ YN0000: · Done in 1s 583ms

angel-luis commented 1 month ago

It looks like yarn versions are stepping on each other. You're mentioning that you're using yarn v1 but this log is from Yarn v4:

yarn dlx create-turbo@canary test-turbo-canary ➤ YN0000: · Yarn 4.2.2 ➤ YN0000: ┌ Resolution step ➤ YN0085: │ + create-turbo@npm:2.0.3-canary.0, @tootallnate/quickjs-emscripten@npm:0.23.0, and 104 more. ➤ YN0000: └ Completed in 1s 457ms ➤ YN0000: ┌ Fetch step ➤ YN0013: │ 106 packages were added to the project (+ 13.68 MiB). ➤ YN0000: └ Completed ➤ YN0000: ┌ Link step ➤ YN0000: └ Completed ➤ YN0000: · Done in 1s 583ms

Yes, I'm using v1 since with corepack enabled is the version Node gives you. yarn -v prints me 1.22.22 when I'm in the root dir, previously to install yarn dlx create-turbo@latest. Probably corepack changes automatically to the new version when using dlx command, but I'm not sure how corepack works in this aspect.

Using for example, yarn dlx create-turbo@latest --example with-tailwind works fine. And I remember about 2 weeks ago to install turbo without any problem.

anthonyshew commented 1 month ago

Thanks for that detail. Continuing to look at what's going on here.

anthonyshew commented 1 month ago

I'm a bit of a loss on this one. I'm using create-turbo@2.0.4-canary.3 and can't seem to reproduce this while using yarn 1 globally with Corepack enabled or disabled.

The only error I can produce is using yarn dlx create-turbo@2.0.4-canary.3 with global yarn 4, which yields this error:

Error: Command failed with exit code 1: yarn install --no-immutable
Usage Error: The nearest package directory (/Users/anthonyshew/projects/debugs/yarnw) doesn't seem to be part of the project declared in /Users/anthonyshew/projects.

- If /Users/anthonyshew/projects isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /Users/anthonyshew/projects is intended to be a project, it might be that you forgot to list debugs/yarnw in its workspace configuration.
- Finally, if /Users/anthonyshew/projects is fine and you intend debugs/yarnw to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

$ yarn install [--json] [--immutable] [--immutable-cache] [--refresh-lockfile] [--check-cache] [--check-resolutions] [--inline-builds] [--mode #0]
    at eN (/private/var/folders/0r/90dc16493lx7gw025k4z8sw40000gn/T/xfs-22628b3e/dlx-41955/.yarn/cache/create-turbo-npm-2.0.4-canary.3-7b93c2fe3a-235ccc7432.zip/node_modules/create-turbo/dist/cli.js:12:57)
    at /private/var/folders/0r/90dc16493lx7gw025k4z8sw40000gn/T/xfs-22628b3e/dlx-41955/.yarn/cache/create-turbo-npm-2.0.4-canary.3-7b93c2fe3a-235ccc7432.zip/node_modules/create-turbo/dist/cli.js:12:8077
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Fl (/private/var/folders/0r/90dc16493lx7gw025k4z8sw40000gn/T/xfs-22628b3e/dlx-41955/.yarn/cache/create-turbo-npm-2.0.4-canary.3-7b93c2fe3a-235ccc7432.zip/node_modules/create-turbo/dist/cli.js:60:2092)
    at async Command.y0 (/private/var/folders/0r/90dc16493lx7gw025k4z8sw40000gn/T/xfs-22628b3e/dlx-41955/.yarn/cache/create-turbo-npm-2.0.4-canary.3-7b93c2fe3a-235ccc7432.zip/node_modules/create-turbo/dist/cli.js:87:2101)
    at async Command.parseAsync (/private/var/folders/0r/90dc16493lx7gw025k4z8sw40000gn/T/xfs-22628b3e/dlx-41955/.yarn/cache/commander-npm-11.1.0-56e979613c-13cc6ac875.zip/node_modules/commander/lib/command.js:936:5) {
  shortMessage: 'Command failed with exit code 1: yarn install --no-immutable',
  command: 'yarn install --no-immutable',
  escapedCommand: 'yarn install --no-immutable',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: "\x1B[31m\x1B[1mUsage Error\x1B[22m\x1B[39m: The nearest package directory (/Users/anthonyshew/projects/debugs/yarnw) doesn't seem to be part of the project declared in /Users/anthonyshew/projects.\n" +
    '\n' +
    "- If /Users/anthonyshew/projects isn't intended to be a project, remove any yarn.lock and/or package.json file there.\n" +
    '- If /Users/anthonyshew/projects is intended to be a project, it might be that you forgot to list debugs/yarnw in its workspace configuration.\n' +
    '- Finally, if /Users/anthonyshew/projects is fine and you intend debugs/yarnw to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.\n' +
    '\n' +
    '\x1B[1m$ \x1B[22myarn install [--json] [--immutable] [--immutable-cache] [--refresh-lockfile] [--check-cache] [--check-resolutions] [--inline-builds] [--mode #0]',
  stderr: '',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

However, this is an error log for Yarn 4 not recognizing the outputs of create-turbo as a Yarn 4 project - because it isn't. I expect to see this error, since our transforms don't support Yarn 4, but it's not the issue shown in the report.

I'm led to believe that this is a Yarn-specific issue somewhere around installation and caching after finding these GitHub issues:

angel-luis commented 1 month ago

I tried it with create-turbo@2.0.4-canary.3 and same error. In my case I'm using nvm instead of installing Node directly, but I think this shouldn't affect to the process.

I've found a related issue in Cypress caused by webpack, I don't know if Turborepo uses webpack but if can help, here is the PR:

anthonyshew commented 1 month ago

I did see that one when I was looking around but create-turbo doesn't get bundled with webpack so I have a hard time seeing it as a culprit.

Seeing as I can't reproduce and there's some history around this that shows it's likely a problem that comes from elsewhere, I'm going to leave this issue open and see if we have anybody else run into it.

xAt0mZ commented 2 weeks ago

Hello @anthonyshew !

I encountered the same issue. Some examples are created without issues (with-berry / with-tailwind), others are not (with-docker).

I only have yarn 4.3.1 installed on my system, through corepack

~$ which yarn
yarn: not found in (...$PATH)

~$ corepack enable --install-directory ~/.corepack yarn

~$ which yarn
~/.corepack/yarn

~$ yarn -v
! Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
? Do you want to continue? [Y/n] n

~$ corepack install -g yarn@stable

~$ which yarn
~/.corepack/yarn

~$ yarn -v
4.3.1

yarn dlx ... shows it is using yarn 4.2.2 but it's expected (see below)

~$ yarn dlx create-turbo@latest --example with-docker
! Corepack is about to download https://repo.yarnpkg.com/4.2.2/packages/yarnpkg-cli/bin/yarn.js
? Do you want to continue? [Y/n] n

Explanations corepack in shell

yarn in shell

corepack.cjs contains this default config

```js var default_config = { yarn: { default: "1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610", fetchLatestFrom: { type: "npm", package: "yarn" }, transparent: { default: "4.2.2+sha224.1e50daf19e5e249a025569752c60b88005fddf57d10fcde5fc68b88f", commands: [ [ "yarn", "init" ], [ "yarn", "dlx" ] ] }, ranges: { "<2.0.0": { url: "https://registry.yarnpkg.com/yarn/-/yarn-{}.tgz", bin: { yarn: "./bin/yarn.js", yarnpkg: "./bin/yarn.js" }, registry: { type: "npm", package: "yarn" }, commands: { use: [ "yarn", "install" ] } }, ">=2.0.0": { name: "yarn", url: "https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js", bin: [ "yarn", "yarnpkg" ], registry: { type: "url", url: "https://repo.yarnpkg.com/tags", fields: { tags: "aliases", versions: "tags" } }, npmRegistry: { type: "npm", package: "@yarnpkg/cli-dist", bin: "bin/yarn.js" }, commands: { use: [ "yarn", "install" ] } } } } } ```

The important part is that corepack references and downloads on demand yarn 4.2.2 when using yarn init or yarn dlx. We don't really care which yarn 2+ version corepack uses under the hood because yarn dlx is not available for yarn 1 anyway.

The alternative way to use yarn 1 with corepack, without enabling it globally, is to run

corepack yarn@1 create turbo --example with-docker

Or if you want to enforce the latest version of yarn

corepack yarn@4 dlx create-turbo@latest --example with-docker

What is happening

Corepack automatically proxies all invocations of yarn and uses either

Turbo examples have a different version depending on the example

All examples using yarn@1.x don't work with yarn dlx proxied by corepack. They error with the following yarn-error.log

``` Arguments: /usr/bin/node ~/.cache/node/corepack/v1/yarn/1.22.19/bin/yarn.js install --no-immutable Yarn version: 1.22.19 Node version: 22.3.0 Platform: linux x64 Trace: Error: ~/tmp/yy/with-docker/node_modules/esbuild: Cannot find module 'pnpapi' Require stack: - ~/.cache/node/corepack/v1/yarn/1.22.19/lib/cli.js - ~/.cache/node/corepack/v1/yarn/1.22.19/bin/yarn.js Require stack: - ~/.cache/node/corepack/v1/yarn/1.22.19/lib/cli.js - ~/.cache/node/corepack/v1/yarn/1.22.19/bin/yarn.js at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15) at require$$0.Module._resolveFilename (/tmp/xfs-b4331f7b/dlx-26941/.pnp.cjs:6680:54) at require.resolve (~/.cache/node/corepack/v1/yarn/1.22.19/lib/v8-compile-cache.js:162:23) at ~/.cache/node/corepack/v1/yarn/1.22.19/lib/cli.js:34243:76 at Generator.next () at step (~/.cache/node/corepack/v1/yarn/1.22.19/lib/cli.js:310:30) at ~/.cache/node/corepack/v1/yarn/1.22.19/lib/cli.js:321:13 npm manifest: { "name": "with-docker", "version": "0.0.0", "private": true, "workspaces": [ "apps/*", "packages/*" ], "scripts": { "build": "turbo run build", "clean": "turbo run clean", "dev": "turbo run dev", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "lint": "turbo run lint", "test": "turbo run test" }, "dependencies": {}, "devDependencies": { "prettier": "^3.2.5", "turbo": "^2.0.5" }, "packageManager": "yarn@1.22.19", "engines": { "node": ">=14.0.0", "npm": ">=7.0.0" } } yarn manifest: No manifest Lockfile: # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 [... truncated -- yarn.lock content ...] ```

What seem to happen is

After the yarn dlx create-turbo errors during the install step, manually going to the turbo repo that was created and doing a yarn install --no-immutable works. This manual step is using the version of yarn defined by the packageManager field (1.22.19 for the with-docker example). Corepack is is doing the same thing as when turbo is invoking the install.

The entire display of yarn dlx create-trubo@latest --example with-docker can be found below

``` 19:30:02 ~/tmp/yy$ yarn dlx create-turbo@latest --example with-docker ➤ YN0000: · Yarn 4.2.2 ➤ YN0000: ┌ Resolution step ➤ YN0085: │ + create-turbo@npm:2.0.5, @tootallnate/quickjs-emscripten@npm:0.23.0, agent-base@npm:7.1.1, ansi-escapes@npm:4.3.2, ansi-regex@npm:5.0.1, ansi-styles@npm:4.3.0, ast-types@npm:0.13.4, and 99 more. ➤ YN0000: └ Completed in 1s 289ms ➤ YN0000: ┌ Fetch step ➤ YN0013: │ 106 packages were added to the project (+ 13.68 MiB). ➤ YN0000: └ Completed ➤ YN0000: ┌ Link step ➤ YN0000: └ Completed ➤ YN0000: · Done in 1s 582ms ? Where would you like to create your Turborepo? with-docker ? Which package manager do you want to use? yarn >>> Creating a new Turborepo with: Application packages - apps/api - apps/web Library packages - packages/eslint-config - packages/jest-presets - packages/logger - packages/typescript-config - packages/ui Installing dependencies... >>> Unexpected error. Please report it as a bug: Error: Command failed with exit code 1: yarn install --no-immutable (node:28923) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. (Use `node --trace-deprecation ...` to show where the warning was created) warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > eslint-config-turbo@2.0.0" has unmet peer dependency "eslint@>6.6.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > eslint-config-prettier@9.1.0" has unmet peer dependency "eslint@>=7.0.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @typescript-eslint/parser@7.1.0" has unmet peer dependency "eslint@^8.56.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @typescript-eslint/eslint-plugin@7.1.0" has unmet peer dependency "eslint@^8.56.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/jest-presets > ts-jest@29.1.2" has unmet peer dependency "jest@^29.0.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/jest-presets > ts-jest@29.1.2" has unmet peer dependency "typescript@>=4.3 <6". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @babel/eslint-parser@7.23.10" has unmet peer dependency "eslint@^7.5.0 || ^8.0.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @typescript-eslint/eslint-plugin@6.20.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @typescript-eslint/parser@6.20.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-import-resolver-typescript@3.6.1" has unmet peer dependency "eslint@*". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-eslint-comments@3.2.0" has unmet peer dependency "eslint@>=4.19.1". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-import@2.29.1" has unmet peer dependency "eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-jest@27.6.3" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-jsx-a11y@6.8.0" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-playwright@0.16.0" has unmet peer dependency "eslint@>=7". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-react@7.33.2" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-react-hooks@4.6.0" has unmet peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-testing-library@6.2.0" has unmet peer dependency "eslint@^7.5.0 || ^8.0.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-unicorn@48.0.1" has unmet peer dependency "eslint@>=8.44.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > eslint-config-turbo > eslint-plugin-turbo@2.0.0" has unmet peer dependency "eslint@>6.6.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @typescript-eslint/eslint-plugin > @typescript-eslint/type-utils@7.1.0" has unmet peer dependency "eslint@^8.56.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @typescript-eslint/eslint-plugin > @typescript-eslint/utils@7.1.0" has unmet peer dependency "eslint@^8.56.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @typescript-eslint/eslint-plugin > @typescript-eslint/type-utils@6.20.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @typescript-eslint/eslint-plugin > @typescript-eslint/utils@6.20.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0". warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-jest > @typescript-eslint/utils@5.62.0" has unmet peer dependency "eslint@^6.0.0 || ^7.0.0 || ^8.0.0". error An unexpected error occurred: "~/tmp/yy/with-docker/node_modules/esbuild: Cannot find module 'pnpapi' Require stack: - ~/.cache/node/corepack/v1/yarn/1.22.19/lib/cli.js - ~/.cache/node/corepack/v1/yarn/1.22.19/bin/yarn.js Require stack: - ~/.cache/node/corepack/v1/yarn/1.22.19/lib/cli.js - ~/.cache/node/corepack/v1/yarn/1.22.19/bin/yarn.js". yarn install v1.22.19 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... [4/5] Linking dependencies... [5/5] Building fresh packages... info If you think this is a bug, please open a bug report with the information provided in "~/tmp/yy/with-docker/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. at QB (/tmp/xfs-8591230c/dlx-28814/.yarn/cache/create-turbo-npm-2.0.5-ada6fa7eaa-9b51f39f72.zip/node_modules/create-turbo/dist/cli.js:12:57) at /tmp/xfs-8591230c/dlx-28814/.yarn/cache/create-turbo-npm-2.0.5-ada6fa7eaa-9b51f39f72.zip/node_modules/create-turbo/dist/cli.js:12:8077 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Fl (/tmp/xfs-8591230c/dlx-28814/.yarn/cache/create-turbo-npm-2.0.5-ada6fa7eaa-9b51f39f72.zip/node_modules/create-turbo/dist/cli.js:58:2092) at async Command.m0 (/tmp/xfs-8591230c/dlx-28814/.yarn/cache/create-turbo-npm-2.0.5-ada6fa7eaa-9b51f39f72.zip/node_modules/create-turbo/dist/cli.js:83:7484) at async Command.parseAsync (/tmp/xfs-8591230c/dlx-28814/.yarn/cache/commander-npm-11.1.0-56e979613c-13cc6ac875.zip/node_modules/commander/lib/command.js:936:5) { shortMessage: 'Command failed with exit code 1: yarn install --no-immutable', command: 'yarn install --no-immutable', escapedCommand: 'yarn install --no-immutable', exitCode: 1, signal: undefined, signalDescription: undefined, stdout: 'yarn install v1.22.19\n' + '[1/5] Validating package.json...\n' + '[2/5] Resolving packages...\n' + '[3/5] Fetching packages...\n' + '[4/5] Linking dependencies...\n' + '[5/5] Building fresh packages...\n' + 'info If you think this is a bug, please open a bug report with the information provided in "~/tmp/yy/with-docker/yarn-error.log".\n' + 'info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.', stderr: '(node:28923) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\n' + '(Use `node --trace-deprecation ...` to show where the warning was created)\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > eslint-config-turbo@2.0.0" has unmet peer dependency "eslint@>6.6.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > eslint-config-prettier@9.1.0" has unmet peer dependency "eslint@>=7.0.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @typescript-eslint/parser@7.1.0" has unmet peer dependency "eslint@^8.56.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @typescript-eslint/eslint-plugin@7.1.0" has unmet peer dependency "eslint@^8.56.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/jest-presets > ts-jest@29.1.2" has unmet peer dependency "jest@^29.0.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/jest-presets > ts-jest@29.1.2" has unmet peer dependency "typescript@>=4.3 <6".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @babel/eslint-parser@7.23.10" has unmet peer dependency "eslint@^7.5.0 || ^8.0.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @typescript-eslint/eslint-plugin@6.20.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @typescript-eslint/parser@6.20.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-import-resolver-typescript@3.6.1" has unmet peer dependency "eslint@*".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-eslint-comments@3.2.0" has unmet peer dependency "eslint@>=4.19.1".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-import@2.29.1" has unmet peer dependency "eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-jest@27.6.3" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-jsx-a11y@6.8.0" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-playwright@0.16.0" has unmet peer dependency "eslint@>=7".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-react@7.33.2" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-react-hooks@4.6.0" has unmet peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-testing-library@6.2.0" has unmet peer dependency "eslint@^7.5.0 || ^8.0.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-unicorn@48.0.1" has unmet peer dependency "eslint@>=8.44.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > eslint-config-turbo > eslint-plugin-turbo@2.0.0" has unmet peer dependency "eslint@>6.6.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @typescript-eslint/eslint-plugin > @typescript-eslint/type-utils@7.1.0" has unmet peer dependency "eslint@^8.56.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @typescript-eslint/eslint-plugin > @typescript-eslint/utils@7.1.0" has unmet peer dependency "eslint@^8.56.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @typescript-eslint/eslint-plugin > @typescript-eslint/type-utils@6.20.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > @typescript-eslint/eslint-plugin > @typescript-eslint/utils@6.20.0" has unmet peer dependency "eslint@^7.0.0 || ^8.0.0".\n' + 'warning "workspace-aggregator-a04c37b4-7654-4b56-898f-0bf222395f29 > @repo/eslint-config > @vercel/style-guide > eslint-plugin-jest > @typescript-eslint/utils@5.62.0" has unmet peer dependency "eslint@^6.0.0 || ^7.0.0 || ^8.0.0".\n' + `error An unexpected error occurred: "~/tmp/yy/with-docker/node_modules/esbuild: Cannot find module 'pnpapi'\n` + 'Require stack:\n' + '- ~/.cache/node/corepack/v1/yarn/1.22.19/lib/cli.js\n' + '- ~/.cache/node/corepack/v1/yarn/1.22.19/bin/yarn.js\n' + 'Require stack:\n' + '- ~/.cache/node/corepack/v1/yarn/1.22.19/lib/cli.js\n' + '- ~/.cache/node/corepack/v1/yarn/1.22.19/bin/yarn.js".', failed: true, timedOut: false, isCanceled: false, killed: false } ```

The interesting part may be

    at QB (/tmp/xfs-8591230c/dlx-28814/.yarn/cache/create-turbo-npm-2.0.5-ada6fa7eaa-9b51f39f72.zip/node_modules/create-turbo/dist/cli.js:12:57)
    at /tmp/xfs-8591230c/dlx-28814/.yarn/cache/create-turbo-npm-2.0.5-ada6fa7eaa-9b51f39f72.zip/node_modules/create-turbo/dist/cli.js:12:8077
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Fl (/tmp/xfs-8591230c/dlx-28814/.yarn/cache/create-turbo-npm-2.0.5-ada6fa7eaa-9b51f39f72.zip/node_modules/create-turbo/dist/cli.js:58:2092)
    at async Command.m0 (/tmp/xfs-8591230c/dlx-28814/.yarn/cache/create-turbo-npm-2.0.5-ada6fa7eaa-9b51f39f72.zip/node_modules/create-turbo/dist/cli.js:83:7484)
    at async Command.parseAsync (/tmp/xfs-8591230c/dlx-28814/.yarn/cache/commander-npm-11.1.0-56e979613c-13cc6ac875.zip/node_modules/commander/lib/command.js:936:5)
wahidbabar commented 2 weeks ago

Faced the same issue, resolved by downgrading node to v18.12.0