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

相关文章
相关标签/搜索