SebastianG
SebastianG

Reputation: 9564

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

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?

Upvotes: 4

Views: 11798

Answers (1)

Jae
Jae

Reputation: 556

  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.

Upvotes: 10

Related Questions