我正在尝试构建一个脚本nvm
,最终将在其中安装节点。
我已经安装nvm
了 cURL。我看到了.profile
or.bashrc
文件中的修改(都有效),并且nvm
在 bash 提示符下键入时,它显示了可用的选项等。
因此 nvm 有效。我可以手动安装节点,但是只要我将nvm
命令放入 shell 脚本中:
nano test.sh
#!/bin/bash
nvm
Run Code Online (Sandbox Code Playgroud)
并运行它:
chmod 755 test.sh
./test.sh
Run Code Online (Sandbox Code Playgroud)
我得到:
./test.sh: line 2: nvm: command not found
Run Code Online (Sandbox Code Playgroud)
如果它找不到nvm
,我什至不必去想
nvm ls-remote
Run Code Online (Sandbox Code Playgroud)
或者
nvm install ...
Run Code Online (Sandbox Code Playgroud)
我安装了 Ubuntu 14.04,Bash 是我的 shell。