前期工作:安装最新版node.js
1、git clone 项目地址
2、进入项目目录,npm install
3、npm run build
配置nginx
server {
listen 8009; #任何可用端口都可以
server_name localhost;
location / {
root /home/xxx/build; #生成文件的路径
try_files $uri $uri/ /index.html last;
index index.html;
add_header Access-Control-Allow-Origin *;
}
}
安装node和npm
curl –silent –location https://rpm.nodesource.com/setup_13.x | sudo bash -
sudo yum install -y nodejs
#卸载旧版本
sudo yum remove -y nodejs npm
本文由 Kevin Yang 发布在 Kevin Yang,转载此文请保持文章完整性,并请附上文章来源(Kevin Yang)及本页链接。
原文链接:https://www.yzj0308.com/centos-build-react-project/
原文链接:https://www.yzj0308.com/centos-build-react-project/