centos7.4系统部署nodejs前端项目

1.安装nodejs运行环境

wget命令下载Node.js安装包,该安装包是编译好的文件,解压之后,在bin文件夹中就已存在node和npm,无需重复编译

wget https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-x64.tar.xz 

tar xvf node-v6.9.5-linux-x64.tar.xz

通过创建软链接的方法,使得在任意目录下都可以直接使用node和npm命令

ln -s /home/node-v6.9.5-linux-x64/bin/node /usr/local/bin/node

ln -s /home/node-v6.9.5-linux-x64/bin/npm /usr/local/bin/npm

查看node、npm版本 

node -v

npm -v

2.安装git环境

安装依赖包

yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

下载git源码并解压

wget https://github.com/git/git/archive/v2.3.0.zip

unzip v2.3.0.zip

cd git-2.3.0

3.编译安装

make prefix=/usr/local/git all

make prefix=/usr/local/git install

查看git版本

git --version

查看git版本,居然还是1.7.1

4.修改环境变量

vi /etc/profile

export PATH=/usr/local/git/bin:$PATH

source /etc/profile

再次查看git版本

git --version

5.git下载项目代码,安装

git clone https://github.com/thx/rap2-dolores.git

npm install

npm run build

由于该项目属于前端项目,使用nginx服务器路由到编译产出的build文件夹作为静态服务器即可。

######################2019-0305报错处理##############################

# make prefix=/etc/opt/git all
CC credential-store.o
In file included from cache.h:4:0,
from credential-store.c:1:
git-compat-util.h:217:10: fatal error: openssl/ssl.h: No such file or directory
#include <openssl/ssl.h>
^~~~~~~~~~~~~~~
compilation terminated.
make: *** [credential-store.o] Error 1

解决办法:

yum install -y openssl-devel

 

posted @ 2018-08-10 16:49  噔噔蹬蹬  阅读(1825)  评论(0编辑  收藏  举报