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

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

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

2. 設置環境變量linux

#vi /etc/profilenpm

添加服務器

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

3. 退出後執行ssh

source /etc/profilepost

此時 運行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

相關文章
相關標籤/搜索