前端 - linux(ubuntu)安装nodejs 配置/etc/profile 环境变量 遇到问题
怪我咯
怪我咯 2017-04-17 11:33:19
[Node.js讨论组]

linux(ubuntu)安装nodejs 配置/etc/profile 环境变量 遇到问题
参照 下载已经编译好的文件进行部署(推荐)

进入/etc/profile 配置环境变量 如下

    # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

export NODE_HOME=/home/jingxiao/install/node-v0.12.0-linux-x64
export PATH=$PATH:$NODE_HOME/bin
export NODE_PATH=$NODE_HOME/lib/node_modules

这样配置,后执行

    source /etc/profile

输入 node -v 没反应,按理说不是应该显示相关版本信息么,输入,npm有东西,比较郁闷,是环境变量配置出错了么。

怪我咯
怪我咯

走同样的路,发现不同的人生

全部回复(2)
怪我咯

npm正常,node有问题,是不是说明你配置node那几行脚本多余了,其实不用配置变量。 删掉试试看。

阿神

sudo ln -s your_node_Path/node /usr/bin/node

直接ln链接就可以

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号