Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: tool installed in global nodejs are not available in project with a different nodejs version #1727

Open
sblask opened this issue Feb 29, 2024 · 2 comments
Labels

Comments

@sblask
Copy link

sblask commented Feb 29, 2024

Describe the Bug

I've got a global .tool-versions file:

python 3.11.7
nodejs 20.11.0
rust 1.73.0
...

and installed typescript-language-server into it:

~ $ which tsserver
/Users/sebastianblask/.asdf/shims/tsserver

~ $ tsserver
Content-Length: 76

{"seq":0,"type":"event","event":"typingsInstallerPid","body":{"pid":74072}}

In one of my projects I've got this in my .tool-versions:

nodejs 18.19.1

and tsserver is not available:

$ tsserver
No preset version installed for command tsserver
Please install a version by running one of the following:

asdf install nodejs 18.19.1

or add one of the following versions in your config file at /Users/sebastianblask/Code/project/.tool-versions
nodejs 20.11.0

When I change my /Users/sebastianblask/Code/project/.tool-versions to:

nodejs 18.19.1 20.11.0

tsserver works, but I don't think this should be necessary? It's also no desirable because the global .tool-versions is specific to my setup and I don't want to force the versions in there onto the people that work on the project.

Steps to Reproduce

See description ^

  1. install one node version globally
  2. npm install -g typescript-language-server
  3. go into another folder
  4. install another node version
  5. try to run tsserver
  6. it's not working

Expected Behaviour

asdf should fall back to global nodejs automatically

Actual Behaviour

asdf gives workaround instead of it just working

Environment

$ asdf info
OS:
Darwin Sebastians-MacBook-Pro.local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64

SHELL:
zsh 5.9 (x86_64-apple-darwin23.0)

BASH VERSION:
5.2.21(1)-release

ASDF VERSION:
v0.14.0-ccdd47d

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/sebastianblask/.asdf
ASDF_DIR=/Users/sebastianblask/.asdf
ASDF_CONFIG_FILE=/Users/sebastianblask/.asdfrc

ASDF INSTALLED PLUGINS:
direnv                       https://github.com/asdf-community/asdf-direnv.git master 2b649c8
editorconfig-checker         https://github.com/gabitchov/asdf-editorconfig-checker.git master 9326459
github-cli                   https://github.com/bartlomiejdanek/asdf-github-cli.git master e0605b7
iamlive                      https://github.com/chessmango/asdf-iamlive.git main a986640
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 9c4e0f2
pre-commit                   https://github.com/jonathanmorley/asdf-pre-commit.git master 26bfc42
python                       https://github.com/danhper/asdf-python.git master 5e277e2
ruby                         https://github.com/asdf-vm/asdf-ruby.git master 3035a4a
rust                         https://github.com/asdf-community/asdf-rust.git master 8436012
shfmt                        https://github.com/luizm/asdf-shfmt.git master a42c5ff
steampipe                    https://github.com/carnei-ro/asdf-steampipe.git main 261baed
terraform-docs               https://github.com/looztra/asdf-terraform-docs.git master acfd01c
terraform                    https://github.com/asdf-community/asdf-hashicorp.git master 197e3ec
tflint                       https://github.com/skyzyx/asdf-tflint.git master 37e7eb9
tfsec                        https://github.com/woneill/asdf-tfsec.git main c36fac5
trivy                        https://github.com/zufardhiyaulhaq/asdf-trivy.git master 537a22a

asdf plugins affected (if relevant)

nodejs - had the same problem with eslint_d for example, so it's not a problem of typescript-language-server. I could not reproduce the problem with Python and pre-commit

@sblask sblask added the bug label Feb 29, 2024
@paulodiovani
Copy link

paulodiovani commented Mar 15, 2024

I have the same issue with yarn.

 $ asdf --version
v0.14.0
 $
 $ asdf list nodejs
  16.18.0
  16.20.2
  18.15.0
  18.16.0
  18.17.1
  18.18.0
  18.18.2
  18.19.1
  20.10.0
 *20.11.1
 $ node --version
v20.11.1
 $
 $ cat .tool-versions
nodejs 20.11.1
 $
 $ npm list -g | grep yarn
└── yarn@1.22.22
 $
 $ yarn --version
No preset version installed for command yarn
Please install a version by running one of the following:

asdf install nodejs 20.11.1

or add one of the following versions in your config file at /Users/v_pgoncalves/Development/GoDaddy/cx-spa/.tool-versions
nodejs 18.16.0

@ogrotten
Copy link

I'm having this problem as well

nodejs 18.19.1 20.11.0

What exactly is this line doing?

I suspect that it's making the old version available, the one that you don't want, to what you're trying to run.

My goal is to update from nodejs 16.15.0 to 18.0.0. Installing 18 and then telling asdf to use it with a .tool-versions does not work, even after doing asdf reshim nodejs 18.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants