Skip to content

Install script: provide a nicer error if NVM cannot be added to the user's shell configuration due to permission issues #3788

Description

@MaddyGuthridge

I teach a university course that uses NodeJS. We currently recommend nvm to our students for installing the correct Node version. Because these students are relative beginners at programming, any issues they encounter during the setup process are very difficult for them to diagnose and debug, and so good error messages are critically important. Of course, good error messages are helpful for all users, not just beginners.

In this case, a student's .zshrc file was owned by root rather than by their user. I believe this has something to do with them incorrectly installing some other development software (possibly Anaconda based on the contents of their .zshrc?). When this happened, the installation script from the readme reported an error saying that it could not write to the file. However, nvm's error message did not make the reasons for the issue clear. When this stage of the installation fails, it would be great if it could check the owner of the file, in order to provide helpful information about why adding it to the configuration failed. It would also be helpful to provide an example of the content that should be added to the .zshrc, so that users have the option to configure it themselves.

Activity

  1. changed the title [-]Install script: provide a nicer error if NVM cannot be added to the user's shell configuration[/-] [+]Install script: provide a nicer error if NVM cannot be added to the user's shell configuration due to permission issues[/+] on Feb 20, 2026
  2. ljharb commented on Feb 20, 2026

    @ljharb
    Member

    That sounds like a great idea! More informative error messages are always helpful.

    I'm going to mark this as "PR wanted", and I'd love it if your students wanted to make a contribution to improve it :-)

    (please strive to limit LLM usage to learning and suggestion, and for contributors to write the code and their prose themselves)

  3. MaddyGuthridge commented on Feb 20, 2026

    @MaddyGuthridge
    Author

    Glad the change is wanted! Sadly a change like this is a bit beyond the abilities of my students (who began learning Git last Tuesday, and definitely don't know bash scripting), but I have implemented the change myself :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pull request wantedThis is a great way to contribute! Help us out :-D

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions