码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2015-09-16 06:19:59      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

在阿里云的服务器安装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

 

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

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!