3

Version:

"packageManager": "yarn@1.22.19"

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?

SebastianG
  • 8,563
  • 8
  • 47
  • 111

1 Answers1

5
  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.

Jae
  • 376
  • 2
  • 11
  • 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. – SebastianG Jul 22 '22 at 15:09