期间,
安装了nvm后,输出:
licrifandeMacBook-Pro:nodejs crifan$ pwd /Users/crifan/dev/dev_src/nodejs licrifandeMacBook-Pro:nodejs crifan$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 7735 100 7735 0 0 4784 0 0:00:01 0:00:01 –:–:– 4783 => Downloading nvm from git to ‘/Users/crifan/.nvm’ => Cloning into ‘/Users/crifan/.nvm’… remote: Counting objects: 4308, done. remote: Total 4308 (delta 0), reused 0 (delta 0), pack-reused 4308 Receiving objects: 100% (4308/4308), 1.09 MiB | 149.00 KiB/s, done. Resolving deltas: 100% (2520/2520), done. Checking connectivity… done. * (HEAD detached at v0.30.1) master => Profile not found. Tried (as defined in $PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile. export NVM_DIR="/Users/crifan/.nvm" => Close and reopen your terminal to start using nvm |
之后,去运行nvm:
licrifandeMacBook-Pro:nodejs crifan$ nvm install 5.0 -bash: nvm: command not found |
搜:
mac Profile not found. Tried (as defined in $PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile
-bash: nvm: command not found · Issue #576 · creationix/nvm
很明显是:
mac中没有对应的bash文件
搜:
mac create .bashrc
osx – How do I create a bash alias? – Stack Overflow
licrifandeMacBook-Pro:nodejs crifan$ cd ~ licrifandeMacBook-Pro:~ crifan$ pwd /Users/crifan licrifandeMacBook-Pro:~ crifan$ touch .bashrc licrifandeMacBook-Pro:~ crifan$ cd ~ licrifandeMacBook-Pro:~ crifan$ ls Applications Documents Library Music Public dev 微云同步盘 Desktop Downloads Movies Pictures StudioProjects ishot-1.png licrifandeMacBook-Pro:~ crifan$ ls -la total 760 drwxr-xr-x+ 32 crifan staff 1088 1 14 12:56 . drwxr-xr-x 6 root admin 204 10 22 10:23 .. … -rw——- 1 crifan staff 9263 1 6 14:11 .bash_history drwxr-xr-x 72 crifan staff 2448 1 14 12:51 .bash_sessions -rw-r–r– 1 crifan staff 0 1 14 12:56 .bashrc … drwxr-xr-x 3 crifan staff 102 9 18 21:12 .local drwxr-xr-x 17 crifan staff 578 1 14 12:49 .nvm … licrifandeMacBook-Pro:~ crifan$ |
然后继续重新安装:
licrifandeMacBook-Pro:~ crifan$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 7735 100 7735 0 0 4291 0 0:00:01 0:00:01 –:–:– 4290 => nvm is already installed in /Users/crifan/.nvm, trying to update using git => => Appending source string to /Users/crifan/.bashrc => Close and reopen your terminal to start using nvm |
但是关闭终端后重新运行nvm还是找不到:
licrifandeMacBook-Pro:~ crifan$ nvm -bash: nvm: command not found licrifandeMacBook-Pro:~ crifan$ cat ~/.bashrc export NVM_DIR="/Users/crifan/.nvm" |
不过后来通过souce了一下:
. ~/.nvm/nvm.sh |
就可以找到nvm了:
Last login: Thu Jan 14 13:00:10 on ttys000 licrifandeMacBook-Pro:~ crifan$ nvm -bash: nvm: command not found licrifandeMacBook-Pro:~ crifan$ cat ~/.bashrc export NVM_DIR="/Users/crifan/.nvm" Node Version Manager Note: <version> refers to any version-like string nvm understands. This includes: Usage: Example: Note: licrifandeMacBook-Pro:~ crifan$ |
然后关闭终端,重启终端,还是无法直接使用nvm:
还是在source:
source ~/.nvm/nvm.sh |
之后才能用。
算了:
删除nvm,重新安装试试:
licrifandeMacBook-Pro:~ crifan$ nvm -bash: nvm: command not found licrifandeMacBook-Pro:~ crifan$ rm ~/.nvm/ .git/ .travis.yml README.markdown nvm.sh .gitattributes CONTRIBUTING.md bash_completion package.json .gitignore LICENSE.md install.sh test/ .npmignore Makefile nvm-exec licrifandeMacBook-Pro:~ crifan$ rm -rf ~/.nvm/ licrifandeMacBook-Pro:~ crifan$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 7735 100 7735 0 0 3413 0 0:00:02 0:00:02 –:–:– 3415 => Downloading nvm from git to ‘/Users/crifan/.nvm’ => Cloning into ‘/Users/crifan/.nvm’… remote: Counting objects: 4308, done. remote: Total 4308 (delta 0), reused 0 (delta 0), pack-reused 4308 Receiving objects: 100% (4308/4308), 1.09 MiB | 247.00 KiB/s, done. Resolving deltas: 100% (2520/2520), done. Checking connectivity… done. * (HEAD detached at v0.30.1) master => Source string already in /Users/crifan/.bashrc Node Version Manager Note: <version> refers to any version-like string nvm understands. This includes: – custom aliases you define with `nvm alias foo` |
还是不行:
重启终端后,还是无法直接运行nvm。。。
算了:
抽空再去研究,如何才能确保:
重启终端后,输入nvm还能识别
-》估计是重启终端后,没有执行到.bashrc
转载请注明:在路上 » [未解决]Mac中安装NVM后无法运行