question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gts does not work in a yarn workspaces monorepo

See original GitHub issue
$ yarn run clean
yarn run v1.22.4
$ gts clean
Error: /home/niko/WebstormProjects/beach/beach-monorepo/packages/server/tsconfig.json Not Found
    at getBase (/home/niko/WebstormProjects/beach/beach-monorepo/node_modules/gts/build/src/util.js:66:15)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ yarn run check
yarn run v1.22.4
$ gts check "src/**/*.ts"
internal/modules/cjs/loader.js:955
  throw err;
  ^

Error: Cannot find module '/home/niko/WebstormProjects/beach/beach-monorepo/packages/server/node_modules/eslint/bin/eslint'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:15)
    at Function.Module._load (internal/modules/cjs/loader.js:835:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

In order to make it work you have to nohoist both gts and eslint.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

2reactions
realphacommented, Apr 22, 2020

Experienced the same issue. The nohoist option is a quick fix, but given eslint package size, it hurts. Espeacially since we want to use it in ALL WORKSPACES. It would be great if gts could use the ‘next’ available eslint binary, althought I can’t anticipate the potential downsides of this…

0reactions
livgustcommented, Apr 29, 2022

I actually ended up doing this since npm workspaces doesn’t have nohoist as an option, so I was stuck. I just removed the gts-specific npm scripts from package.json and kept the configs since those were working without issue. I have a top-level lint that is working with gts so I just make sure my CI/CD pipeline uses that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workspaces - Yarn
Workspaces are a new way to set up your package architecture that's available by default starting from Yarn 1.0. It allows you to...
Read more >
Improved mono-repo for Typescript + Cloud Function ...
I've addressed this using yarn workspaces and following a mono-repo pattern that is common when developing node packages.
Read more >
react native - Monorepo: Yarn workspaces not working
I am using monorepo created using Yarn Workspaces with Typescript which has a react-native project (mobile folder) and a common folder which ...
Read more >
JS Monorepo Blog Part 2 - Carbon Health
It outlines our existing problems and our initial solutions ... We decided to move forward with Yarn Modern Workspaces since we were already ......
Read more >
Migrating our Monorepo to Yarn 2 | DoltHub Blog
We wanted React 18 to be more stable before upgrading and webpack 4 was not working with Yarn 2. Once we upgraded React...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found