Homebrew는 nvm을 설치하지만 나중에 nvm을 찾을 수 없습니까?
나는 새로운 OSX 10.10.1 설치를 사용 homebrew
하고 oh-my-zsh
있습니다. 나는 그것을 nvm
통해 homebrew
그것을 실행하려고 시도했지만 -zsh : command not found : nvm
문제가 무엇인지 아십니까? 나는 git을 잘 설치하고 사용할 수있었습니다 ...
업데이트 : 2019 년 9 월 20 일
DarkPurple141 및 Elise van Looij의 최근 답변에서 언급 했듯이 . nvm
와 호환되지 않는 것 같습니다 homebrew
. 이것은 여기에있는 공식 nvm-sh repo에도 명시되어 있습니다 .
Homebrew 설치는 지원되지 않습니다. homebrew가 설치된 nvm에 문제가있는 경우 문제를 제기하기 전에 아래 지침에 따라 제거하고 설치하십시오.
참고 : zsh를 사용하는 경우 nvm을 zsh 플러그인으로 쉽게 설치할 수 있습니다. zsh-nvm을 설치하고 nvm upgrade를 실행하여 업그레이드합니다.
다음 단계가 도움이 될 것입니다.
- $
brew uninstall nvm
- $
brew cleanup
(좋은 측정을 위해) - $
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
$를 실행하여 nvm이 올바르게 설치되었는지 확인하십시오
command -v nvm
.4.a 응답이 $가 아닌
nvm
경우 ~ / .bash-profile 파일에 다음 두 줄을 추가합니다.export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
4.b 컴퓨터를 다시 시작합니다 (먼저 터미널을 닫고 다시 시작할 수 있음)command -v nvm should now return
4.c $ nvm`이제 $로 Node.js를 업데이트하십시오.
nvm install --lts
- npm 업데이트 : $
nvm install-latest-npm
- $
npm install --global mocha
. 마지막으로 성공! 글쎄, 나도 당신을 위해 희망합니다.
주의 사항에 나열된 지침을 따랐습니까?
[~] brew info nvm
nvm: stable 0.20.0, HEAD
https://github.com/creationix/nvm
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/nvm.rb
==> Caveats
Add the following to $HOME/.bashrc, $HOME/.zshrc, or your shell's
equivalent configuration file:
source $(brew --prefix nvm)/nvm.sh
Node installs will be lost upon upgrading nvm. Add the following above
the source line to move install location and prevent this:
export NVM_DIR=~/.nvm
추가 구성이 없으면 기본적으로 NVM을 찾을 수 없습니다.
There are TWO things you need to do. Follow the caveats shown after installing nvm via brew, and THEN you need to activate/reload the .bash_profile changes.
- Run
brew install nvm
- Follow caveats shown in console, mine were as follows, yours MAY be different!:
Add the following to ~/.bash_profile or your desired shell configuration file:
export NVM_DIR="$HOME/.nvm" . "$(brew --prefix nvm)/nvm.sh"
- Run
. ~/.bash_profile
to apply the changes you made to your .bash_profile file
While the accepted answer does technically work, it's worth noting that Homebrew installation is not officially supported by the nvm
package. The recommended way to avoid issues like those raised above is to apply either of the below methods of installation.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
# or wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
source: https://github.com/creationix/nvm
I've spent a couple of hours going round and round on this issue, but I've come to the conclusion that DarkPurple141 is right: nvm just isn't compatible with Homebrew, as they state on their Github nvm-sh/nvm Node Version Manager. Homebrew will install nvm and everything looks fine, until one tries to get npm to install a module, Mocha in my case. That threw me right back to the dreaded error:
ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
The solution, on MacOS 10.14 Mojave, was:
- $
brew uninstall nvm
- $
brew cleanup
(just for good measure) - $
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
Check that nvm was installed correctly by running $
command -v nvm
.4.a If the response is anything other than $
nvm
, add the following two lines to the ~/.bash-profile file:export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
4.b Restart your computer (you can try closing Terminal and restarting it first) 4.c $command -v nvm should now return
nvm`Now update Node.js with $
nvm install --lts
- Update npm: $
nvm install-latest-npm
- $
npm install --global mocha
. Finally, success! Well, for me and I hope for you too.
The reason you would need to reload your bash profiles or any other bash files might be because the command nvm may not be a program but a function that is defined and can only be used if the corresponding bash file is sourced.
On a system that I checked
which nvm
does not work but
nvm list
does. This means that you can use the word "nvm" to invoke something. That something isn't a program. In the current case, it is a function which can be verified by
typeset -F | grep -P ' nvm$'
which outputs
declare -F nvm
즉, nvm은 다음을 수행하여 본문을 검사 할 수있는 함수입니다.
type -F nvm
brew
사용 된 경우 한 가지 가능성 은 nvm
특히 다른 MAC OS 사용자가 설치 한 경우 링크가 해제 될 수 있다는 것입니다.
이 경우 다음을 실행하십시오.
brew link nvm
nvm을 설치하려면 brew install nvm
설치 후 또는 한 번만 nvm을 실행하려면 $(brew --prefix nvm)/nvm.sh
NVM 매번 실행하려면 zsh
열립니다
nano ~/.zshrc
- 이 줄 추가
source $(brew --prefix nvm)/nvm.sh
참고 URL : https://stackoverflow.com/questions/27651892/homebrew-installs-nvm-but-nvm-cant-be-found-afterwards
'developer tip' 카테고리의 다른 글
동적 ArrayList 항목 유형이있는 Gson TypeToken (0) | 2020.11.14 |
---|---|
Java 8에 Scala의 Either와 동등한 것이 있습니까? (0) | 2020.11.14 |
Keycloak의 OAuth2 / OpenID Connect 엔드 포인트는 무엇입니까? (0) | 2020.11.14 |
Visual Studio에서 '웹 사이트'와 '프로젝트'의 차이점 (0) | 2020.11.14 |
Python에 익명의 클래스가 있습니까? (0) | 2020.11.14 |