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

Install error: Profile not found. Tried ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile. #1837

Closed
dillon opened this issue Jun 15, 2018 · 13 comments
Labels
installing nvm: profile detection Issues with nvm's own install script, related to figuring out the right profile file. installing nvm Problems installing nvm itself OS: Mac OS

Comments

@dillon
Copy link

dillon commented Jun 15, 2018

  • Operating system and version: OSX High Sierra 10.13.5 (17F77)

  • nvm debug output:
    nvm: command not found

  • nvm ls output:
  • How did you install nvm? (e.g. install script in readme, Homebrew):
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

  • What steps did you perform?
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

  • What happened?

=> nvm is already installed in /Users/dillon/.nvm, trying to update using git
=> => Compressing and cleaning up git repository

=> Profile not found. Tried ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.
=> Create one of them and run this script again
   OR
=> Append the following lines to the correct file yourself:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
  • What did you expect to happen?
    install nvm
  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
    I just factory reset my macbook, installed xcode, accepted xcode terms, installed brew, and then tried to install nvm. echo $PATH returns /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
  • If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?
    ...* Connection #0 to host nodejs.org left intact
@dillon
Copy link
Author

dillon commented Jun 16, 2018

I ran touch ~/.bash_profile and things seem to be working. Is that the right thing to do?

@dillon
Copy link
Author

dillon commented Jun 16, 2018

Just read this. It fixed my problem.

Note: On OS X, if you get nvm: command not found after running the install script, one of the following might be the reason:-

your system may not have a [.bash_profile file] where the command is set up. Simply create one with touch ~/.bash_profile and run the install script again
you might need to restart your terminal instance. Try opening a new tab/window in your terminal and retry.

@dillon dillon closed this as completed Jun 16, 2018
@ljharb ljharb added OS: Mac OS installing nvm: profile detection Issues with nvm's own install script, related to figuring out the right profile file. installing nvm Problems installing nvm itself labels Jun 16, 2018
@sk8Guerra

This comment has been minimized.

@Rallanvila

This comment has been minimized.

@ligantx
Copy link

ligantx commented Jul 6, 2021

i'm new to macOS so although its super simple, i couldnt find a solution to a similar problem with you for hours.
So, my fellow Windows users, Big Sur uses zsh and not bash as it was before. So the installation doesnt work as it is.
You have to:

  1. run curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
  2. touch ~/.zshrc
    This creates (i dont know if this exists by default) the zshrc file, which is the things a new terminal runs everytime you open a new one. So, in windows you have to add the nvm directory to PATH (Environment Variables etc). Here, you have to add the nvm path to zshrc. So:
  3. nano ~/.zshrc and add export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm and save ^o, ^x
  4. open a new terminal and run nvm..stuff should be written

@HduSy

This comment was marked as resolved.

@tahireu
Copy link

tahireu commented Feb 10, 2022

i'm new to macOS so although its super simple, i couldnt find a solution to a similar problem with you for hours. So, my fellow Windows users, Big Sur uses zsh and not bash as it was before. So the installation doesnt work as it is. You have to:

  1. run curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
  2. touch ~/.zshrc
    This creates (i dont know if this exists by default) the zshrc file, which is the things a new terminal runs everytime you open a new one. So, in windows you have to add the nvm directory to PATH (Environment Variables etc). Here, you have to add the nvm path to zshrc. So:
  3. nano ~/.zshrc and add export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm and save ^o, ^x
  4. open a new terminal and run nvm..stuff should be written

Or simply run step 2 first, and then step 1.

Step 3 can be excluded in this case.

But terminal still needs to be restarted.

@levlionn
Copy link

This was super helpful!

@nabilHaouam
Copy link

this was helpful , thank you

@Pkmmte
Copy link

Pkmmte commented Dec 11, 2022

In my case, this was caused by the $HOME environment variable not being set when trying to install nvm via a user data script in AWS EC2.

Defining the variable before running the nvm install script fixed it for me:

export HOME=/home/ec2-user

Hopefully this helps someone. ✨

@ljharb
Copy link
Member

ljharb commented Dec 11, 2022

@Pkmmte that sounds like a bug i'd report to amazon; I'd expect $HOME to always be set.

@LemarAb
Copy link

LemarAb commented Dec 3, 2023

i'm new to macOS so although its super simple, i couldnt find a solution to a similar problem with you for hours. So, my fellow Windows users, Big Sur uses zsh and not bash as it was before. So the installation doesnt work as it is. You have to:

  1. run curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
  2. touch ~/.zshrc
    This creates (i dont know if this exists by default) the zshrc file, which is the things a new terminal runs everytime you open a new one. So, in windows you have to add the nvm directory to PATH (Environment Variables etc). Here, you have to add the nvm path to zshrc. So:
  3. nano ~/.zshrc and add export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm and save ^o, ^x
  4. open a new terminal and run nvm..stuff should be written

for those still getting bash: nvm: command not found, run source ~/.nvm/nvm.sh and try again.

@akshay636
Copy link

I encountered the same issue in MacOS while attempting to install nvm.
Here are the steps I took to resolve it:

  1. Create a Bash Profile:
    If you're facing a bash profile issue, create a new bash profile by running the following command in your terminal:

    touch ~/.bash_profile
    
  2. Re-run the Installation Command:
    After creating the bash profile, re-run the nvm installation command using the following:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
    
  3. Restart Terminal:
    Close the current terminal window and open a new one to ensure the changes take effect.

  4. Verify Installation:
    Confirm that nvm is installed by checking its version:

    nvm -v
    
  5. Load nvm:
    If you encounter a "command not found" error, it's possible that nvm isn't loaded. You can load it with the following command:

    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
    

I Hope this should help you get nvm up and running on your macOS system!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installing nvm: profile detection Issues with nvm's own install script, related to figuring out the right profile file. installing nvm Problems installing nvm itself OS: Mac OS
Projects
None yet
Development

No branches or pull requests