vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.21k stars 1.81k forks source link

Unsupported URL Type "workspace:": workspace:* using npm or yarn #8208

Closed dead8309 closed 4 months ago

dead8309 commented 5 months ago

Verify canary release

Link to code that reproduces this issue

npx create-turbo@latest -e with-docker

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

npm, Yarn v1

What operating system are you using?

Windows

Which canary version will you have in your reproduction?

latest

Describe the Bug

I'm not able to create a new project using with-docker template.

Tested package managers:

Yarn Logs ``` npx create-turbo@latest -e with-docker >>> TURBOREPO >>> Welcome to Turborepo! Let's get you set up with a new codebase. ? Where would you like to create your turborepo? ./test ? Which package manager do you want to use? yarn workspaces Downloading files for example with-docker. This might take a moment. >>> Created a new Turborepo with the following: apps - apps/api - apps/web packages - packages/eslint-config - packages/jest-presets - packages/logger - packages/typescript-config - packages/ui 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 error Couldn't find package "@repo/eslint-config@workspace:*" required by "@repo/logger@0.0.0" on the "npm" registry. Error: Couldn't find package "@repo/typescript-config@workspace:*" required by "@repo/logger@0.0.0" on the "npm" registry. at MessageError.ExtendableBuiltin (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:721:66) at new MessageError (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:750:123) at PackageRequest. (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:36620:17) at Generator.throw () at step (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:310:30) at /home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:323:13 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Error: Couldn't find package "@repo/jest-presets@workspace:*" required by "@repo/logger@0.0.0" on the "npm" registry. at MessageError.ExtendableBuiltin (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:721:66) at new MessageError (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:750:123) at PackageRequest. (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:36620:17) at Generator.throw () at step (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:310:30) at /home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:323:13 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) yarn install v1.22.22 [1/5] Validating package.json... [2/5] Resolving packages... info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. at QB (/home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/create-turbo/dist/cli.js:12:57) at /home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/create-turbo/dist/cli.js:12:8077 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Fl (/home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/create-turbo/dist/cli.js:60:2093) at async Command.y0 (/home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/create-turbo/dist/cli.js:87:2121) at async Command.parseAsync (/home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/commander/lib/command.js:936:5) { shortMessage: 'Command failed with exit code 1: yarn install', command: 'yarn install', escapedCommand: 'yarn install', exitCode: 1, signal: undefined, signalDescription: undefined, stdout: 'yarn install v1.22.22\n' + '[1/5] Validating package.json...\n' + '[2/5] Resolving packages...\n' + 'info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.', stderr: `error Couldn't find package "@repo/eslint-config@workspace:*" required by "@repo/logger@0.0.0" on the "npm" registry.\n` + `Error: Couldn't find package "@repo/typescript-config@workspace:*" required by "@repo/logger@0.0.0" on the "npm" registry.\n` + ' at MessageError.ExtendableBuiltin (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:721:66)\n' + ' at new MessageError (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:750:123)\n' + ' at PackageRequest. (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:36620:17)\n' + ' at Generator.throw ()\n' + ' at step (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:310:30)\n' + ' at /home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:323:13\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' + `Error: Couldn't find package "@repo/jest-presets@workspace:*" required by "@repo/logger@0.0.0" on the "npm" registry.\n` + ' at MessageError.ExtendableBuiltin (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:721:66)\n' + ' at new MessageError (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:750:123)\n' + ' at PackageRequest. (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:36620:17)\n' + ' at Generator.throw ()\n' + ' at step (/home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:310:30)\n' + ' at /home/kiit/.nvm/versions/node/v20.13.1/lib/node_modules/yarn/lib/cli.js:323:13\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)', failed: true, timedOut: false, isCanceled: false, killed: false } ```
Npm Logs ``` npx create-turbo@latest -e with-docker >>> TURBOREPO >>> Welcome to Turborepo! Let's get you set up with a new codebase. ? Where would you like to create your turborepo? test2 ? Which package manager do you want to use? npm workspaces Downloading files for example with-docker. This might take a moment. >>> Created a new Turborepo with the following: apps - apps/api - apps/web packages - packages/eslint-config - packages/jest-presets - packages/logger - packages/typescript-config - packages/ui 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: npm install npm ERR! code EUNSUPPORTEDPROTOCOL npm ERR! Unsupported URL Type "workspace:": workspace:* npm ERR! A complete log of this run can be found in: /home/kiit/.npm/_logs/2024-05-23T19_49_35_228Z-debug-0.log at QB (/home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/create-turbo/dist/cli.js:12:57) at /home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/create-turbo/dist/cli.js:12:8077 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Fl (/home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/create-turbo/dist/cli.js:60:2093) at async Command.y0 (/home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/create-turbo/dist/cli.js:87:2121) at async Command.parseAsync (/home/kiit/.npm/_npx/e8c68b66aeb1424f/node_modules/commander/lib/command.js:936:5) { shortMessage: 'Command failed with exit code 1: npm install', command: 'npm install', escapedCommand: 'npm install', exitCode: 1, signal: undefined, signalDescription: undefined, stdout: '', stderr: 'npm ERR! code EUNSUPPORTEDPROTOCOL\n' + 'npm ERR! Unsupported URL Type "workspace:": workspace:*\n' + '\n' + 'npm ERR! A complete log of this run can be found in: /home/kiit/.npm/_logs/2024-05-23T19_49_35_228Z-debug-0.log', failed: true, timedOut: false, isCanceled: false, killed: false } ```

Expected Behavior

A working project with no errors

To Reproduce

npx create-turbo@latest -e with-docker

Additional context

Ok so this error doesn't show up in canary version but canary is not respecting -e with-docker flag strange🤔

chris-olszewski commented 4 months ago

If you change workspace:* dependencies manually in the with-docker example then it'll work with Yarn 1 and npm. You can use the --skip-install step to avoid the error on the initial create-turbo run. I know this isn't ideal, but the example is designed to be used with pnpm.

Ok so this error doesn't show up in canary version but canary is not respecting -e with-docker flag strange🤔

Can you try with 1.13.4-canary.4?

aditya-enthu commented 4 months ago

Hello All,

@dead8309 @chris-olszewski

New to this project, I am trying to build docker image following the instructions under examples/with-docker which throws packages error. Any help or idea what I am missing?

Thank you.

I have tried branch main, tags v1.13.4-canary.4 and v2.0.0-canary.2, none helps to run the docker compose cmd.

user: examples/with-docker [git: main]

└─ $ COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f docker-compose.yml build
 => CACHED [web installer  5/10] COPY --from=builder /app/out/json/ .                                                                                        0.0s
 => CACHED [web installer  6/10] COPY --from=builder /app/out/yarn.lock ./yarn.lock                                                                          0.0s
 => CANCELED [web installer  7/10] RUN yarn install                                                                                                          1.3s
 => CACHED [api installer  4/10] COPY .gitignore .gitignore                                                                                                  0.0s
 => CACHED [api installer  5/10] COPY --from=builder /app/out/json/ .                                                                                        0.0s
 => CACHED [api installer  6/10] COPY --from=builder /app/out/yarn.lock ./yarn.lock                                                                          0.0s
 => ERROR [api installer  7/10] RUN yarn install                                                                                                             1.3s
------                                                                                                                                                            
 > [api installer  7/10] RUN yarn install:
0.604 yarn install v1.22.19
0.712 [1/5] Validating package.json...
0.731 [2/5] Resolving packages...
1.207 error Couldn't find package "@repo/eslint-config@workspace:*" required by "@repo/logger@0.0.0" on the "npm" registry.
1.207 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
1.213 Error: Couldn't find package "@repo/typescript-config@workspace:*" required by "@repo/logger@0.0.0" on the "npm" registry.
1.213     at MessageError.ExtendableBuiltin (/opt/yarn-v1.22.19/lib/cli.js:721:66)
1.213     at new MessageError (/opt/yarn-v1.22.19/lib/cli.js:750:123)
1.213     at PackageRequest.<anonymous> (/opt/yarn-v1.22.19/lib/cli.js:36590:17)
1.213     at Generator.throw (<anonymous>)
1.213     at step (/opt/yarn-v1.22.19/lib/cli.js:310:30)
1.213     at /opt/yarn-v1.22.19/lib/cli.js:323:13
1.213     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
1.213 Error: Couldn't find package "@repo/jest-presets@workspace:*" required by "@repo/logger@0.0.0" on the "npm" registry.
1.213     at MessageError.ExtendableBuiltin (/opt/yarn-v1.22.19/lib/cli.js:721:66)
1.213     at new MessageError (/opt/yarn-v1.22.19/lib/cli.js:750:123)
1.213     at PackageRequest.<anonymous> (/opt/yarn-v1.22.19/lib/cli.js:36590:17)
1.213     at Generator.throw (<anonymous>)
1.213     at step (/opt/yarn-v1.22.19/lib/cli.js:310:30)
1.213     at /opt/yarn-v1.22.19/lib/cli.js:323:13
1.213     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
------
failed to solve: process "/bin/sh -c yarn install" did not complete successfully: exit code: 1

While I try npx create-turbo. cmd, it works as expected.

user: examples/with-docker [git: main]
└─ $ npx create-turbo@latest -e with-docker

>>> TURBOREPO

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

? Where would you like to create your turborepo? ./my-turborepo
? Which package manager do you want to use? pnpm workspaces

Downloading files for example with-docker. This might take a moment.

>>> Created a new Turborepo with the following:

apps
 - apps/api
 - apps/web
packages
 - packages/eslint-config
 - packages/jest-presets
 - packages/logger
 - packages/typescript-config
 - packages/ui

Installing packages. This might take a couple of minutes.

>>> Success! Created a new Turborepo at "my-turborepo".
Inside that directory, you can run several commands:

  pnpm run build
     Build all apps and packages

  pnpm run dev
     Develop all apps and packages

  pnpm run lint
     Lint all apps and packages

  pnpm run test
     Test 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:

  pnpm dlx turbo login

We suggest that you begin by typing:

  cd my-turborepo
  pnpm dlx turbo login

user: examples/with-docker [git: main]
└─ $ cd my-turborepo/

user: examples/with-docker [git: main]
└─ $ pnpm run build

> with-docker@0.0.0 build /Users/user/Documents/projects/pro1/turbo/examples/with-docker/my-turborepo
> turbo run build

• Packages in scope: @repo/eslint-config, @repo/jest-presets, @repo/logger, @repo/typescript-config, @repo/ui, api, web
• Running build in 7 packages
• Remote caching disabled
........

 Tasks:    3 successful, 3 total
Cached:    0 cached, 3 total
  Time:    12.386s 

user: examples/with-docker [git: main]
└─ $ pnpm run dev

> with-docker@0.0.0 dev /Users/user/Documents/projects/pro1/turbo/examples/with-docker/my-turborepo
> turbo run dev

• Packages in scope: @repo/eslint-config, @repo/jest-presets, @repo/logger, @repo/typescript-config, @repo/ui, api, web
• Running dev in 7 packages
• Remote caching disabled
api:dev: cache bypass, force executing 6e008f5778e5b3b8
.........
api:dev: [nodemon] 3.1.2
api:dev: [nodemon] to restart at any time, enter `rs`
api:dev: [nodemon] watching path(s): *.*
api:dev: [nodemon] watching extensions: ts
api:dev: [nodemon] starting `node -r esbuild-register ./src/index.ts`
web:dev:   ▲ Next.js 14.2.3
web:dev:   - Local:        http://localhost:3000
web:dev:   - Experiments (use with caution):
web:dev:     · outputFileTracingRoot
web:dev: 
web:dev:  ✓ Starting...
@repo/logger:dev: [6:21:24 PM] Found 0 errors. Watching for file changes.
@repo/logger:dev: 
api:dev: logger: api running on 3001
web:dev:  ✓ Ready in 1385ms
web:dev:  ○ Compiling / ...
web:dev:  ✓ Compiled / in 998ms (445 modules)
web:dev:  GET / 200 in 1090ms
api:dev: GET /message/hello 200 2.681 ms - 25
anthonyshew commented 4 months ago

The example was configured incorrectly and has now been fixed. Sorry about that, folks!

aditya-enthu commented 4 months ago

I can confirm that it worked fine, thank you for quick fix.