Skip to content

Having to restart TS server every time I build a package in a workspace #55450

Closed

Description

Type: Bug

I have a monorepo setup, using workspaces.
Whenever I rebuild one of my packages, all files in another workspace can no longer resolve types for it. That is until I do cmd + shift + P -> TS restart

VS Code version: Code 1.81.0 (Universal) (6445d93c81ebe42c4cbd7a60712e0b17d9463e97, 2023-08-02T12:40:02.782Z)
OS version: Darwin arm64 21.4.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 7, 9, 9
Memory (System) 32.00GB (0.07GB free)
Process Argv --crash-reporter-id 971cdb5c-5eac-4e31-85ae-d33323f572d4
Screen Reader no
VM 0%
Extensions (9)
Extension Author (truncated) Version
postcss css 1.0.9
vscode-eslint dba 2.4.2
gitlens eam 14.2.1
prettier-vscode esb 10.1.0
vscode-jest-runner fir 0.4.66
angular-console nrw 18.6.0
vscode-stylelint sty 1.2.4
vscode-mdx uni 1.4.0
vscode-css-variables vun 2.6.3
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30792226
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vscccc:30803845
282f8724:30602487
89544117:30613380
showlangstatbar:30737416
vsctsb:30748421
03d35959:30757346
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
gsofa:30804715
pythonnosmt12:30797651
pythonidxpt:30805730
pythonnoceb:30805159
e537b577:30795824
dsvsc013:30795093
dsvsc014:30804076

Activity

  1. vscodenpa commented on Aug 17, 2023

    @vscodenpa

    Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.81.1. Please try upgrading to the latest version and checking whether this issue remains.

    Happy Coding!

  2. gittymcgit commented on Aug 17, 2023

    @gittymcgit
    Author

    Updated. still persists

  3. mjbvz commented on Aug 17, 2023

    @mjbvz
    Contributor

    Please share a project which demonstrates the issue

  4. gittymcgit commented on Aug 18, 2023

    @gittymcgit
    Author

    https://github.com/gittymcgit/vs-code-bug-repro

    Screen.Recording.2023-08-18.at.16.54.07.mp4
  5. removed their assignment
    on Aug 21, 2023
  6. added
    Needs Investigation
    on Aug 23, 2023
  7. adrianord commented on Aug 24, 2023

    @adrianord

    I'm facing the same issue using tsserver with neovim, also using pnpm workspaces. My set up is very similar to the above example repo, but using tsc directly instead of vite.

  8. sheetalkamat commented on Sep 13, 2023

    @sheetalkamat
    Member

    Timur Zhidkov (@gittymcgit) the repro you shared doesnt work for me since when i open index.tsx, the import is not resolved.
    Do i need any special setup apart form running pnpm install
    Do you have any repro that doesnt involve pnpm.

    image

    Thanks

  9. added
    Needs More Info
    and removed
    Needs Investigation
    on Sep 13, 2023
  10. 7 remaining items

  11. sebastien-f commented on Jan 31, 2024

    @sebastien-f

    Sheetal Nandi (@sheetalkamat) here is a repo that reproduce the issue : https://github.com/sebastien-f/vs-code-ts-server-needs-restart
    Here is the tsserver.log

    Steps to follow :

    1. clone repo
    2. in project root : npm i
    3. in packages/package1 : npm run build
    4. open VS Code
    5. open file packages/package2/src/index.ts, everything is fine (as expected)
    6. from npm scripts in VS Code, run build for package1
    7. package1 is underlined in red (which is the issue, and unexpected)
    8. restart TS Server
    9. everything is fine again

    Also a video here (had to make 2 parts because of the recording software) :

    1. first part with the commands in PS : https://www.youtube.com/watch?v=pvTf-c3b5PE
    2. second part in VS Code : https://www.youtube.com/watch?v=OII7kYvr7b8

    In the second video I forgot to restart the TS Server at the end, but it solves the issue.

  12. sheetalkamat commented on Feb 2, 2024

    @sheetalkamat
    Member

    sebastien-f thank you for the repro and the log, i am able to see the issue. Its to do with use watching node_modules and not node_modules/package1 for changes to resolution.

  13. added
    Bug
    and removed
    Needs More Info
    on Feb 2, 2024
  14. r0ssIV commented on Mar 27, 2024

    @r0ssIV

    Is this bug still not fixed? A year has passed - having same issue in VSCode 1.87.2

  15. r0ssIV commented on Mar 28, 2024

    @r0ssIV

    Sheetal Nandi (@sheetalkamat) do you have any info if it is issue with typescript or VSCode
    Have created a tiny demo project showing the issue + brief description in README.md

    https://github.com/rivaros/demo-ts-server-failure

    p.s.: sebastien-f have you got it resolved? can see you are using workspaces, in my case it is a link tool https://github.com/privatenumber/link but the issue still is the same and is probably related to cleaning (rimraf, rf inside linked package)

  16. sebastien-f commented on Mar 28, 2024

    @sebastien-f

    p.s.: sebastien-f have you got it resolved? can see you are using workspaces, in my case it is a link tool https://github.com/privatenumber/link but the issue still is the same and is probably related to cleaning (rimraf, rf inside linked package)

    I'm not working on that side project at the moment, but had a workaround with a keyboard shortcut (ctrl t+s) to reload TS.

  17. kasvith commented on Apr 2, 2024

    @kasvith

    im also facing the same issue, tsserver is crashing in a PNPM Monorepo(non shared tsconfig)

    [error] TSServer exited. Code: null. Signal: SIGTERM
    
  18. t-johansson commented on Apr 3, 2024

    @t-johansson

    Having the same issue in a PNPM monorepo, VSCode 1.87.2. Any time i build one of the internal packages i need to restart the TS server.

  19. mastershadow commented on Apr 3, 2024

    @mastershadow

    Having the same issue in a PNPM monorepo, VSCode 1.87.2. Any time i build one of the internal packages i need to restart the TS server.

    Same here.

  20. added
    Fix Available
    on Apr 9, 2024
  21. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugFix Available

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions