Linux報“ '/usr/bin' is not included in the PATH environment variable”解決方法


在阿里雲的服務器安裝nodejs,配置環境變量過程中,出現問題以及解決方法。

1. 以下是node和npm的路徑:

2. 設置環境變量

#vi /etc/profile

添加

#set node npm path
NODE_HOME=/home/app/node-v4.0.0-linux-x64/bin
export PATH=$NODE_HOME:$PATH

3. 退出后執行

source /etc/profile

此時 運行node -v沒有問題。

但是問題來了,如果以上:$PATH忘了加或者拼寫錯誤,在以后使用ls或者vi等命令會報錯

類似於:Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found

**解決方法:**

由於系統找不到原來設置的環境變量,所有需要修改 /etc下的profile文件,

但是此時我們已經不能直接使用vi命令了,其實可以使用

# /usr/bin/vi /etc/profile

修改export PATH=$NODE_HOME:$PATH將其修改正確

此時需要退出當前ssh,再從新登陸,剛才的設置才可生效。

此時測試一下ls命令:

 

本文地址:http://www.cnblogs.com/alvinwei1024/p/4811993.html

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM