手动安装nodejs并配置环境变量(zsh个人版)
发表于更新于
阅读量: 成都
NodeJS简介
//todo
下载Nodejs程序包
请根据时间使用最新或者指定的nodejs版本链接
1 2
| md /root/soft && cd /root/soft wget https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz
|
解压tar.xz压缩包
1 2 3
| tar -xf node-v18.16.0-linux-x64.tar.xz mv node-v18.16.0-linux-x64 node18 rm node-v18.16.0-linux-x64.tar.xz
|
配置环境变量/etc/.zprofile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| #
#
export NODE_HOME=/root/soft/node18 PATH="$PATH:$HOME/bin:$NODE_HOME/bin" export PATH
_src_etc_profile() { # Make /etc/profile happier, and have possible ~/.zshenv options like # NOMATCH ignored. # emulate -L ksh
# source profile if [ -f /etc/profile ]; then source /etc/profile fi } _src_etc_profile
unset -f _src_etc_profile
|
最后使用source /etc/zprofile 来使配置生效。
检查配置结果