yarn not installing packages from workspace but instead tries pulling down from npmjs with turborepo
Asked Answered
G

1

5

Version:

"packageManager": "[email protected]"

I have based my project off of the npx create-turbo@latest command.

I have eslint-config-custom and tsconfig projects inside my /packages folder which I reference in my three nodejs apps with:

 "tsconfig": "workspace:*",
 "eslint-config-custom": "workspace:*",

and in my root package.json workspaces are defined:

  "workspaces": [
    "apps/*",
    "packages/*"
  ],

Unfortunately, when I run yarn or yarn install in the root folder, yarn pops up telling me to select a matching version:

yarn install v1.22.19
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
Couldn't find any versions for "eslint-config-custom" that matches "workspace:0.0.0"
? Please choose a version of "eslint-config-custom" from this list: (Use arrow keys)
> 0.0.0

Same for the tsconfig dependency, then it only lists versions available for the packages with the same name on the main npmjs.com registry.

How do I get yarn to use the dependency from a workspace?

Additionally, how could I deal with them with a scope, and instead of tsconfig to install from @myOrg/tsconfig?

Grig answered 20/7, 2022 at 20:28 Comment(0)
A
10
  1. In your app's package.json, try these
 "tsconfig": "*",
 "eslint-config-custom": "*",

In pnpm, packages are installed by workspaces:*, but in other package managers you can do it by only *. We are using yarn, so * would be work.

Take a look at Offical Example.


  1. If I understand it correctly, answer for the additional question is posted in github discussions.

In package.json's name field, include your organization scope. (@myOrg/package-name) But don't change your folder's structure or it's name.

Anatolic answered 21/7, 2022 at 4:57 Comment(1)
That was it, my initial project was made with pnpm and had to switch to yarn because of the prune command not working, but then switched back.Grig

© 2022 - 2024 — McMap. All rights reserved.