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

Global installs not being found in npm@7 #227

Closed
jonatan-ivanov opened this issue Apr 10, 2021 · 8 comments
Closed

Global installs not being found in npm@7 #227

jonatan-ivanov opened this issue Apr 10, 2021 · 8 comments

Comments

@jonatan-ivanov
Copy link

Globally installed packages can't be executed and the command fails with command not found.
Workaround: export PATH="$PATH:$(asdf where nodejs)/.npm/bin" (though I guess this won't work with version change)

@augustobmoura
Copy link
Member

augustobmoura commented Apr 10, 2021

Try running asdf rehism nodejs after npm install -g, .npm/bin should not be in the path (not without workarounds) this is not how asdf works internally, the problem with adding $(asdf where nodejs) to PATH is that the value can change from context to context. Instead asdf creates a shim for every executable in .npm/bin so that it can point to the correct nodejs version

This is caused by a npm@7 regression, as of now we will need to manually run asdf reshim nodejs after every global install, I'm currently researching a way of not relying in .hooks to auto reshim

@augustobmoura augustobmoura changed the title .npm/bin is not on PATH Global installs not being found in npm@7 Apr 19, 2021
@augustobmoura
Copy link
Member

Okay, so I pushed a new mechanism for auto-reshimming that works by wrapping the npm command and only reshimming when necessary. Instead of relying on npm node_modules/.hooks.

@jonatan-ivanov, can you update your asdf-nodejs and test if everything is working as intended?

@jonatan-ivanov
Copy link
Author

@augustobmoura Thanks for looking into this. I uninstalled and installed a package, both times I see the message: Reshimming asdf nodejs... and this works now, thank you! :)

@igorcafe
Copy link

I installed asdf using AUR and I'm still having this issue, even after reopening my terminal.

issue.mp4

@WorstPractices
Copy link

I installed asdf using AUR and I'm still having this issue, even after reopening my terminal.

did you get this straightened out? i have the same issue.

@rroslaniec
Copy link

same here

@iloveitaly
Copy link

running into this as well, I wonder if it has something to do with the global vs local asdf nodejs version. If I have more time to investigate further, I'll reach out.

@TamasBarta
Copy link

@iloveitaly, if the global one was used to install the npm package instead of the asdf managed version, I believe you should still get the command in the path, but not managed by asdf. I start to believe that npm itself is faulty, because I tried setting asdf's nodejs to system, and I just have no way of getting any command to work. The workaround mentioned here also doesn't work for me, because that directory has no commands either. (export PATH="$PATH:$(asdf where nodejs)/.npm/bin") I'm confused.

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

No branches or pull requests

7 participants