Giter Club home page Giter Club logo

Comments (9)

anothermh avatar anothermh commented on August 22, 2024 1

I resolved this same issue with TypeScript 5.5.x by upgrading yarn 4.3.0 to 4.4.0.

  • yarn set version stable to upgrade yarn
  • yarn install to update config
  • yarn dlx @yarnpkg/sdks vscode to reinstall TypeScript SDK

Then reload VSCode with >Developer: Reload Window.

from berry.

psychobolt avatar psychobolt commented on August 22, 2024

Yarn should work correctly since you are updating dependencies/running tasks from shell. It gets finicky when changes are being detected in VSCode (e.g. reinstalling eslint, stylelint, or any other linter and compiler tools) This is more a issue with the IDE extensions or language server. Another thing to make sure is if VSCode is using the correct Typescript. It should be using the Workspace TS SDK and due to security reasons, if your not prompted by a choice when opening project then you'll have to select it manually so it gets saved, hence the enablePromptUseWorkspaceTsdk: true in settings.json, unrelated to tsdk...

from berry.

SheepReaper avatar SheepReaper commented on August 22, 2024

Yarn should work correctly since you are updating dependencies/running tasks from shell. It gets finicky when changes are being detected in VSCode (e.g. reinstalling eslint, stylelint, or any other linter and compiler tools) This is more a issue with the IDE extensions or language server. Another thing to make sure is if VSCode is using the correct Typescript. It should be using the Workspace TS SDK and due to security reasons, if your not prompted by a choice when opening project then you'll have to select it manually so it gets saved, hence the enablePromptUseWorkspaceTsdk: true in settings.json, unrelated to tsdk...

I have indicated in the OP to make sure that the correct typescript is being used. I've also purposely not installed anything beyond the minimum to get @yarnpkg/sdks working for typescript. I've also indicated reloading the window to get a clean startup. It's my understanding that the typescript language server uses the tsserver.js that's in the repo (installed by the SDK), and the typescript that's installed locally, which is patched.

Now, seeing as how everything works as intended when node-modules linking is enabled, and only breaks once pnp is enabled (reliably I might add) This leads to me to believe the issue is probably not the language server. Instead, it narrows it down to arcanis.vscode-zipfs, the typescript patch (yarn), or the typescript vscode SDK (also yarn).

I'd appreciate it if another soul could reproduce this. I posted both the repro repo and step-by-step instructions in the OP.

from berry.

SheepReaper avatar SheepReaper commented on August 22, 2024

I just downgraded to typescript 5.4.5 and works with [email protected]

| yarn | typescript | works |

| 3.8.3 | 5.5.3 | yes |
| 4.3.1 | 5.4.5 | yes |
| 4.3.1 | 5.5.3 | no |

from berry.

SheepReaper avatar SheepReaper commented on August 22, 2024

Actually, I just updated to vscode 1.91.1, which also updates the language server. everything seems to be working now. (June update)

from berry.

psychobolt avatar psychobolt commented on August 22, 2024

BTW, noticed that npm is installed on home drive, which on a different path than your node and yarn. Are you using nvm install to setup node? Before you start VSCode, make sure VSCode is using the correct node in your path.

If switching between node versions, you'll need to reinstall project dependencies again.

from berry.

SheepReaper avatar SheepReaper commented on August 22, 2024

Good eye. yes, i used nvm. There are multiple versions of node installed, but they're all here: ~/.nvm/versions/node/ just the normal location for nvm. But the reason that you're seeing yarn inside of /tmp is because that's what it does when corepack is enabled. yarn no longer needs to be installed globally, corepack resolves, downloads, and extracts it for you. So that's all normal.

But vscode on startup looks for node, and gives you a nice/ugly error when it can't find it. I didn't encounter it. I don't see how it could find the wrong version since it must be the same version invoked when I do it from the cli.

from berry.

psychobolt avatar psychobolt commented on August 22, 2024

Maybe I'm on OSX, I find it strange that binaries are not extracted to same folder as npm and node as well e.g. .nvm/versions/node/v20.15.0/bin/yarn - at least that is consistent with nvm installs on my end. I think possibly nvm already ships with yarn. Installing binaries in /tmp is not in good practice for stable environments, if that is expected outside of npx or yarn dlx.

from berry.

SheepReaper avatar SheepReaper commented on August 22, 2024

corepack ships with node as of version 16.10.0, but it's disabled by default. As of version 18.0.0 it's enabled by default. corepack looks at your package.json for "packageManager" and uses that to determine which package manager to use. Alternatively, if you just invoke yarn without having first installed it globally, it downloads it for you. So it may as well be installed.

from berry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.