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

nvm install-latest-npm equivalent #202

Open
KerickHowlett opened this issue Jan 18, 2023 · 4 comments
Open

nvm install-latest-npm equivalent #202

KerickHowlett opened this issue Jan 18, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@KerickHowlett
Copy link

Is there a way to mirror the native nvm feature of installing the latest npm version for the current Node version?

Recently, I ran into an issue where I had to use Node v12 for a project and executed npm i -g npm, which installed a version of npm that's incompatible with Node v12.

Native nvm has the means to install the latest npm version intelligently for specific Node versions by executing nvm install-latest-npm.

Is there a way to mirror that feature for nvm.fish?

@ljharb
Copy link

ljharb commented Jan 18, 2023

As far as I'm aware, nvm is the only thing in the ecosystem that encapsulates this logic. (linking to nvm-sh/nvm#3010)

@KerickHowlett
Copy link
Author

Hello again! lol

Is there a way to put a nvm.fish wrapper around that particular command?

@jorgebucaran jorgebucaran added the enhancement New feature or request label Jan 20, 2023
@jorgebucaran
Copy link
Owner

Sorry for the late reply. Could you please help me understand what install-latest-npm is and how it could be useful? I haven't come across a situation where I needed it, so I'm not sure how or why I should port it to nvm.fish.

@KerickHowlett
Copy link
Author

KerickHowlett commented Apr 29, 2023

TL;DR: Was working on an Angular project that hadn't been updated in a real long time, and I believe I ran into an edge case where updating npm made it to where I couldn't install or run anything, because it wouldn't work with Node 12.

Full Explanation

At the time I posted this issue at work where I attempted to install the latest version of npm after having to switch to (what I believe was) Node 12.

Anytime I install a different Node version, I'll install the latest version of npm immediately out of habit.

This resulted in many issues where I couldn't get anything to run or install for the project. After some investigating and debugging, I ended up having to uninstall everything for Node 12, only without updating npm to get it to work.

Now, a part of my frustrating journey here led me to asking the team behind the original nvm -- I know you don't actually reuse any of their code, but I was looking for answers where I could find them -- and they told me I had installed an incompatible version of npm that wasn't fully compatible with Node 12.

That was when they instructed me to use npm-install-latest, because it used logic to install the latest version of npm still compatible with an argued version of Node.

With all that said, I will also add I discovered something, after making my initial post, where the project I had been working on was using a dependency which had had deprecated for a long time -- or may have even reached its EOL -- that had been causing problems with the project installations. The library was old enough to require the legacy flag, anyway.

While I believe the issue I posted is still valid, the outdated dependency may have also contributed to the roadblock I was facing at the time.

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

No branches or pull requests

3 participants