'".nvm" not in PATH - Apple M1 Macbook
I am using an Apple M1 Macbook pro, with the 'zsh' terminal, and there are issues installing Node with the command "nvm install node". After trying that nvm command, I went ahead and downloaded Node directly from https://nodejs.org/en/download/
I want to make sure that the node installation references the directory NVM installs node via the PATH. However, this is what I am seeing.
When I run the command "which node", I get the following current output. I have listed the expected output as well. Is there a way to fix this?
Current output: /usr/local/bin/node
Expected output: /Users/username/.nvm/versions/node/v14.15.4/bin/node
Solution 1:[1]
if you take a closer look at nvm installation instructions, you will notice that there is an information about how to set a deeper shell integration.
it is even noted in brew
$ brew info nvm
...
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.
You should create NVM's working directory if it doesn't exist:
mkdir ~/.nvm
Add the following to /Users/geek/.bash_profile or your desired shell
configuration file:
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
You can set $NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.
Type `nvm help` for further information.
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
since you are interested in zsh deeper shell integration, do this (i intentionally do not include a snippet from the official documentation, so it will be up-to-date)
Solution 2:[2]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mr. |
Solution 2 | Vishal Kongre |