-
-
Notifications
You must be signed in to change notification settings - Fork 603
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
ddev nvm use ...
has no effect on subsequent ddev npm --version
.
#6013
Comments
Interesting conversation in discord: It seems this problem occurs if there are multiple node versions installed with nvm. |
Actually, Still this leaves the question how nvm can be used effectively in ddev. |
Yeah, there's really no real use for nvm any more in DDEV now that nodejs_version can use anything. Do you need to review Or is something really broken? nvm is a pretty fragile shell based system, to be avoided where possible. |
Not sure what I would review there.
In the current project I work on, it is fine to use one global node and npm version. I could imagine a Drupal project with multiple sub-themes that use different versions of npm. The command for the first option would be I think documentation still contains references to nvm which are not really helpful. |
It seems to be working fine to me, what am I doing differently from you?
|
I think this is the difference:
Does this still happen if you install additional versions? |
if I install node 6 for example, I do seem to have to I also note that in your setup you're using nvm in a hook, which is possibly outside the bash environment that nvm depends on. nvm is not a binary at all, but instead a set of pretty silly bash includes, which is usually the main problem with using it. (BTW, you have about 100 dead containers. You can clean up with |
This is also my experience: A simple
I tried with this hook on and off, what you see is just a snapshot.
Thanks! |
Yeah, it's your job to decide what you post publicly. When people have sensitive naming they usually edit beforehand. In DDEV v1.23.0 we'll have an improved version of I don't think we can fix all the privacy issues from our end, but we're trying to make it easier for you. |
yeah, no problem, I just wanted to announce that I am removing some of it. |
Oh, I just noticed that your original complaint is about npm. I thought it was about node I seem to be setting npm set predictably. Now with nvm set to 6:
If I set default to 19:
I'm not at all sure you're looking at a problem in DDEV behavior compared to a problem in nvm behavior. |
I need to have both node and npm on the right version. The background here is in Drupal radix theme, the documentation says to run The problem was that the state change from See https://www.drupal.org/project/radix/issues/3423681#comment-15513600 |
Please check carefully to see if your problem is with DDEV's use of nvm or if it's a problem with nvm itself. I suspect the latter. You can use |
Ah, thanks for that. DDEV won't know how to do that, and certainly |
To be clear: However, the documentation could be updated where it mentions nvm:
For the last point about the hook I am not sure. I think these only need to run when the container is created, not whenever it is started. This will help people like this, https://discord.com/channels/664580571770388500/1199750600653549598 |
Could you take a run at a docs PR? Click the pencil in the upper right of the page. There is certainly confusion about this, and I'm really glad we can now specify a specific nodejs_version (and any nodejs_version) thanks to @hanoii People do still complain occasionaly about being able to separately control the npm version. The docs were recently updated to try to suggest that people not use nvm unless they really need it for something. |
I can try, when I have time. |
It would be good to have this information in a future stable release, so: |
Thanks for stepping up @stasadev ! |
hey all, thanks for clarifying this all, this is a very useful thread! I experienced the same thing when I came into a project that was already setup and running for a year or so. There were some nvm statements in the post-start and when we were upgrading this codebase (and node/npm version) we got into the same trouble. The config.yaml stated 18, npm on the container would 'reset' to 15, even when we had a The wording of "Use of Thanks again, I was search for my problem in the past issues, and I already found it. Thanks so much! |
I thought
Finally found this answer:
I don't know why there are so many tutorials that show and recommend |
Is there an existing issue for this?
Output of
ddev debug test
Expand `ddev debug test` diagnostic information
Expected Behavior
Steps:
After "ddev nvm use 20": "Now using node v20.11.1 (npm v10.2.4)".
After "ddev npm --version": "10.2.4"
After "ddev exec which npm": "/home/lemonhead/.nvm/versions/node/v20.11.1/bin/npm"
Actual Behavior
After "ddev npm version": "6.14.18"
After "ddev exec which npm": "/home/lemonhead/.nvm/versions/node/v7.10.1/bin/npm"
On the other hand:
When I use
ddev ssh
and then runnvm use 20
andnpm --version
, I do get the updated npm version.Steps To Reproduce
(I think this section belongs above the "Expected behavior", does it not?)
Anything else?
I tried a number of ways to set the npm version using nvm:
ddev nvm use 20
ddev npm
.ddev exec nvm use 20
andddev exec npm --version
.exec
.nvm install 20 && nvm use 20
inhooks/post-start//exec
in.ddev/config.yaml
.ddev npm --version
still gives me the old version.nodejs_version: "20"
in.ddev/config.yaml
RUN nvm install 20
andRUN nvm use 20
in.ddev/web-build/Dockerfile
.What actually did work was
ddev nvm alias default 20.11.1
.Adding this in
.ddev/config.yml
inhooks/post-start//exec
works, but:.nvmrc
that is placed in a subdirectory somewhere.I did find related issues here in github, but they did not answer my question:
Btw, I am originally coming from this issue for Drupal Radix: https://www.drupal.org/project/radix/issues/3423681
The text was updated successfully, but these errors were encountered: