Why is tsc command not found in child package in yarn workspace?
Asked Answered
B

0

7

I'm using yarn version 3.2.4. I have a package.json in my root that looks like this:

{
  "scripts": {
    "compile": "tsc --build",
  },
  "devDependencies": {
    "typescript": "^4.8.4"
  }
}

In packages/foo, I have this package.json

{
  "scripts": {
    "compile": "tsc --build"
  },
  "devDependencies": {
  }
}

When I run yarn compile from the root, tsc compiles correctly. But this fails:

cd packages/foo
yarn compile

command not found: tsc

If I change the child packages to include typescript as a devDependency then it works.

Why aren't the devDependencies inherited from the parent package.json?

Beane answered 15/12, 2022 at 18:51 Comment(1)
were you able to find a solution to this? I just encountered this on trying to update to yarn v3.Grilse

© 2022 - 2024 — McMap. All rights reserved.