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

devon npm setup ignores a given version #667

Closed
fdcg opened this issue Jan 5, 2022 · 4 comments · Fixed by #672 or #668
Closed

devon npm setup ignores a given version #667

fdcg opened this issue Jan 5, 2022 · 4 comments · Fixed by #672 or #668
Labels
bug Something isn't working npm node package manager setup related to the setup process of devonfw-ide (setup[.bat] and devon ... setup) update related to updating software or the entire devonfw-ide

Comments

@fdcg
Copy link
Contributor

fdcg commented Jan 5, 2022

Expected behavior

As a user, I want to define the variable NPM_VERSION as described in the documentation so that this defined version is installed with devon npm setup.

Actual behavior

The variable NPM_VERSION is ignored and there is only the NPM version installed with node available.

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. Install node with devon node setup
  2. Call npm -version and notice the version
  3. Set the variable NPM_VERSION to a different version.
  4. Call devon npm setup
  5. Call npm -version

The output of step 5 is the same as of step 2.

Related/Dependent Issues

Comments/Hints:

Affected version:

  • Devon scripts: 2020.08.002
  • OS: Windows
  • Browser: independent
@fdcg fdcg added the bug Something isn't working label Jan 5, 2022
@hohwille
Copy link
Member

hohwille commented Jan 6, 2022

npm command itself just delegates to node:

doDevonCommand node setup silent

Seems that someone thought an implicit requirement is to get latest npm insode node command:

doDevonCommand npm install -g @devon4node/cli@latest

IMHO I did not design this part.
Can someone still shed a light into this?

IMHO the expecation of @fdcg is correct and building on this I would say:

  1. node command should not install or update npm at all
  2. only npm command should do that
  3. npm command should honor ${NPM_VERSION} variable to be consistent with all other commandlets. Only if that variable is undefined it should fallback to latest.

@hohwille
Copy link
Member

hohwille commented Jan 6, 2022

@fdcg It seems that npm version is somehow bundled with node version. So the safest and easiest approach would be to maintain NODE_VERSION in your project that in the end will both manage node and npm for your project as these two bundled together are guaranteed to work in together fine.

Do you happen to need a specific npm version AND a speciifc node version that do not come together?
We could easily add some logic to npm commandlet that checks for NPM_VERSION and if present does the exact installation of that npm version regardless of the node version used. However, this approach could easily end in a setup that is broken.

@hohwille hohwille added npm node package manager setup related to the setup process of devonfw-ide (setup[.bat] and devon ... setup) update related to updating software or the entire devonfw-ide labels Jan 6, 2022
@hohwille
Copy link
Member

hohwille commented Jan 6, 2022

I created a simple fix with PR #672
@fdcg Is this solving your needs?

hohwille added a commit that referenced this issue Jan 6, 2022
@hohwille hohwille added this to the release:2021.12.003 milestone Jan 6, 2022
@fdcg
Copy link
Contributor Author

fdcg commented Jan 10, 2022

@hohwille
Yes, using the NPM version installed with Node should be the default, that's OK.
However, installing NPM with npm install -g "npm@${NPM_VERSION}" does not work, because this would require npm to replace itself.
In fact, I get errors here as well.
The way from my pull request does nothing else, but without NPM, and works.

hohwille added a commit that referenced this issue Jan 25, 2022
* Bugfix or issue #667 - devon npm setup ignores a given version

* constructive review changes

* Adaptation to new download process

Co-authored-by: fdcg <fdcg@users.noreply.github.com>
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working npm node package manager setup related to the setup process of devonfw-ide (setup[.bat] and devon ... setup) update related to updating software or the entire devonfw-ide
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants