前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >安装“人生重开模拟器” – 学金融的文史哲小生

安装“人生重开模拟器” – 学金融的文史哲小生

作者头像
去海边整点薯条
发布2022-11-01 14:02:58
5080
发布2022-11-01 14:02:58
举报
文章被收录于专栏:数模计量

游戏体验地址:人生重开模拟器

一、安装GIT工具

上文已经记录了Centos8安装Git的完整过程,这里不再赘述。

二、下载源代码

代码地址:人生重开模拟器

代码语言:javascript
复制
[root@C20210805207038 home]# git clone https://github.com/AliyunWorkbench/lifeRestart.git

正克隆到 'lifeRestart'...
remote: Enumerating objects: 112, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 112 (delta 20), reused 10 (delta 10), pack-reused 62
接收对象中: 100% (112/112), 791.09 KiB | 4.82 MiB/s, 完成.
处理 delta 中: 100% (31/31), 完成.

三、安装npm

代码语言:javascript
复制
[root@C20210805207038 lifeRestart]# sudo yum module install nodejs

上次元数据过期检查:0:22:31 前,执行于 2022年02月12日 星期六 13时29分50秒。
依赖关系解决。
===========================================================================================================================================================
 软件包                           架构                   版本                                                              仓库                       大小
===========================================================================================================================================================
安装组/模块包:
 nodejs                           x86_64                 1:10.24.0-1.module_el8.3.0+717+fa496f1d                           AppStream                 8.8 M
 npm                              x86_64                 1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d                 AppStream                 3.7 M
安装弱的依赖:
 nodejs-full-i18n                 x86_64                 1:10.24.0-1.module_el8.3.0+717+fa496f1d                           AppStream                 7.3 M
安装模块配置档案:
 nodejs/common                                                                                                                                            
启用模块流:
 nodejs                                                  10                                                                                               

事务概要
===========================================================================================================================================================
安装  3 软件包

总下载:20 M
安装大小:71 M
确定吗?[y/N]: y
下载软件包:
(1/3): npm-6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64.rpm                                                      388 kB/s | 3.7 MB     00:09    
(2/3): nodejs-full-i18n-10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64.rpm                                                   443 kB/s | 7.3 MB     00:16    
(3/3): nodejs-10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64.rpm                                                             501 kB/s | 8.8 MB     00:18    
-----------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                       1.1 MB/s |  20 MB     00:18     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  运行脚本: npm-1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64                                                                               1/1 
  准备中  :                                                                                                                                            1/1 
  安装    : nodejs-full-i18n-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64                                                                            1/3 
  安装    : npm-1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64                                                                               2/3 
  安装    : nodejs-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64                                                                                      3/3 
  运行脚本: nodejs-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64                                                                                      3/3 
  验证    : nodejs-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64                                                                                      1/3 
  验证    : nodejs-full-i18n-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64                                                                            2/3 
  验证    : npm-1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64                                                                               3/3 

已安装:
  nodejs-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64                      nodejs-full-i18n-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64              
  npm-1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64              

完毕!

四、在源代码目录安装依赖

代码语言:javascript
复制
[root@C20210805207038 lifeRestart]# npm install

> core-js@3.21.0 postinstall /home/lifeRestart/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js:
> https://opencollective.com/core-js 
> https://patreon.com/zloirock 
> https://paypal.me/zloirock 
> bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for webpack-dev-server@4.7.4: wanted: {"node":">= 12.13.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: webpack-dev-server@4.7.4
npm WARN notsup Unsupported engine for http-proxy-middleware@2.0.3: wanted: {"node":">=12.0.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: http-proxy-middleware@2.0.3
npm WARN notsup Unsupported engine for open@8.4.0: wanted: {"node":">=12"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: open@8.4.0
npm WARN notsup Unsupported engine for schema-utils@4.0.0: wanted: {"node":">= 12.13.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: schema-utils@4.0.0
npm WARN notsup Unsupported engine for strip-ansi@7.0.1: wanted: {"node":">=12"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: strip-ansi@7.0.1
npm WARN notsup Unsupported engine for webpack-dev-middleware@5.3.1: wanted: {"node":">= 12.13.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: webpack-dev-middleware@5.3.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN notsup Unsupported engine for ansi-regex@6.0.1: wanted: {"node":">=12"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: ansi-regex@6.0.1
npm WARN notsup Unsupported engine for schema-utils@4.0.0: wanted: {"node":">= 12.13.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: schema-utils@4.0.0
npm WARN xlsx_transform@ No repository field.
npm WARN xlsx_transform@ No license field.

added 511 packages from 331 contributors and audited 512 packages in 32.109s

53 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

五、编译打包

代码语言:javascript
复制
[root@C20210805207038 lifeRestart]# npm run build

> xlsx_transform@ build /home/lifeRestart
> webpack --mode production && cp -r ./view/* ./public/ && cp -r ./data ./public/ && mv public build

asset bundle.js 783 KiB [emitted] [minimized] [big] (name: main)
orphan modules 85.9 KiB [orphan] 8 modules
runtime modules 221 bytes 1 module
modules by path ./node_modules/core-js/internals/*.js 118 KiB
  ./node_modules/core-js/internals/to-string-tag-support.js 210 bytes [built] [code generated]
  ./node_modules/core-js/internals/well-known-symbol.js 1.03 KiB [built] [code generated]
  ./node_modules/core-js/internals/global.js 590 bytes [built] [code generated]
  + 151 modules
modules by path ./node_modules/core-js/modules/*.js 70.8 KiB
  ./node_modules/core-js/modules/es.object.to-string.js 380 bytes [built] [code generated]
  ./node_modules/core-js/modules/es.promise.js 14 KiB [built] [code generated]
  ./node_modules/core-js/modules/web.dom-collections.for-each.js 887 bytes [built] [code generated]
  ./node_modules/core-js/modules/es.array.iterator.js 2.45 KiB [built] [code generated]
  + 31 modules
./src/index.js + 8 modules 87.8 KiB [built] [code generated]
./node_modules/regenerator-runtime/runtime.js 24.3 KiB [built] [code generated]

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  bundle.js (783 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (783 KiB)
      bundle.js

WARNING in webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/

webpack 5.68.0 compiled with 3 warnings in 6764 ms

六、检查文件编译情况

代码语言:javascript
复制
[root@C20210805207038 lifeRestart]# ls
bitcoin:  build.sh  _config.yml     data      _layouts  node          package.json       README.md  src   utils  webpack.config.cjs
build     CNAME     core-js@3.21.0  index.md  LICENSE   node_modules  package-lock.json  repl       test  view   yarn.lock

[root@C20210805207038 lifeRestart]# cd build

[root@C20210805207038 build]# ls
bundle.js            dark.css  iconfont.ttf   iconfont.woff2  index.html  manifest.json  test.html
condition_test.html  data      iconfont.woff  images          light.css   sw.js

出现了build文件夹,说明编译完成。

七、将build文件部署为站点

运行如下代码,站点即为 localhost:5000(临时使用)

代码语言:javascript
复制
npm run build
npm run preview

http-serve部署(长期部署)

代码语言:javascript
复制
npm install http-server -g
dist目录下运行 http-server -p 5000

Starting up http-server, serving ./public

http-server version: 14.1.0

http-server settings: 
CORS: disabled
Cache: 3600 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

Available on:
  http://127.0.0.1:8080
  http://10.10.155.2:8080
Hit CTRL-C to stop the server

八、开放相应端口

代码语言:javascript
复制
查看防火墙某个端口是否开放
firewall-cmd --query-port=3306/tcp
开放防火墙端口3306
firewall-cmd --zone=public --add-port=3306/tcp --permanent
注意:开放端口后要重启防火墙生效
重启防火墙
systemctl restart firewalld
关闭防火墙端口
firewall-cmd --remove-port=3306/tcp --permanent
查看防火墙状态
systemctl status firewalld
关闭防火墙
systemctl stop firewalld
打开防火墙
systemctl start firewalld
开放一段端口
firewall-cmd --zone=public --add-port=40000-45000/tcp --permanent
查看开放的端口列表
firewall-cmd --zone=public --list-ports
查看被监听(Listen)的端口
netstat -lntp
检查端口被哪个进程占用
netstat -lnp|grep 3306
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-02-12 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、安装GIT工具
  • 二、下载源代码
  • 三、安装npm
  • 四、在源代码目录安装依赖
  • 五、编译打包
  • 六、检查文件编译情况
  • 七、将build文件部署为站点
  • 八、开放相应端口
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档