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

Fix Issue #56: Can't install latest version of npm globally #74

Merged
merged 1 commit into from
May 25, 2018

Conversation

andrewthauer
Copy link
Contributor

Fix for issue #56

Note: This is based on the new feature in asdf (PR - asdf-vm/asdf#314)

The idea is to allow plugins to override the shim's specified executable path. In the case of npm the command may exist in one of 2 locations (bin/npm - by install or .npm/bin/npm - if upgraded manually).

This works in tandom with a change in asdf core that will look for the
exec-path command and use it appropriately when found to conditionally
route the npm & npx commands to the correct executable path.
@rstacruz
Copy link
Contributor

rstacruz commented May 24, 2018

LGTM... I like this fix. I think this is good to merge, @asdf-vm!

@HashNuke HashNuke merged commit f70fa9e into asdf-vm:master May 25, 2018
@adamyonk
Copy link

adamyonk commented May 25, 2018

👋 I'm still seeing the bad functionality on asdf and asdf-nodejs latest versions. Is there anything else that needs to happen or am I missing something? Thanks!

❯ npm -v
5.6.0

❯ npm i -g npm
/Users/adamyonk/.asdf/installs/nodejs/8.9.4/.npm/bin/npx -> /Users/adamyonk/.asdf/installs/nodejs/8.9.4/.npm/lib/node_modules/npm/bin/npx-cli.js
/Users/adamyonk/.asdf/installs/nodejs/8.9.4/.npm/bin/npm -> /Users/adamyonk/.asdf/installs/nodejs/8.9.4/.npm/lib/node_modules/npm/bin/npm-cli.js
+ [email protected]
added 682 packages in 25.517s

❯ asdf reshim nodejs

❯ npm -v
5.6.0

@adamyonk
Copy link

adamyonk commented May 25, 2018

Ah, interesting, I was on asdf 0.4.3, but asdf update --head seems to be ahead of that release and I can confirm it is working there!

@Stratus3D
Copy link
Member

@adamyonk yes I need to tag a new version. Working on it now. Version 0.5.0 should be out within the next 3 hours.

@Stratus3D
Copy link
Member

Out of curiosity, where does this .npm directory reside? I'm not very familiar with Node.JS.

@andrewthauer
Copy link
Contributor Author

@Stratus3D - The .npm directory is actually not a standard directory in nodejs. In the context of asdf it comes from the usage of NPM_CONFIG_PREFIX override location used in exec-env. Another option to fix this issue could have been to remove the custom exec-env from asdf-nodejs that (which could still be done).

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

Successfully merging this pull request may close these issues.

5 participants