CentOS搭建ThinkJS开发环境
参考:腾讯云手动实验https://cloud.tencent.com/developer/labs/lab/10098
搭建THinkJS需要Node.js来下载安装
安装Node.js
下载Node.js的源码安装包
[root@localhost ~]# wget https://npm.taobao.org/mirrors/node/v14.0.0/node-v14.0.0-linux-x64.tar.xz
解压Node.js源码包
[root@localhost ~]# tar xf node-v14.0.0-linux-x64.tar.xz
添加Node.js的命令到系统环境变量中
[root@localhost ~]# mv node-v14.0.0-linux-x64 /usr/local/nodejs
[root@localhost ~]# vim /etc/profile
# 末尾添加
export PATH=$PATH:/usr/local/nodejs/bin
[root@localhost ~]# source /etc/profile
[root@localhost ~]# node -v
v14.0.0
安装ThinkJS
npm安装ThinkJS
--verbose
:显示详细信息
[root@localhost ~]# npm install thinkjs@2 -g --verbose
创建验证项目
执行如下命令
[root@localhost ~]# thinkjs new project_path;
安装项目依赖
[root@localhost ~]# cd project_path
[root@localhost project_path]# npm install --verbose
启动项目
启动之后为阻塞方式
[root@localhost project_path]# npm start
...
[2020-04-26 16:08:39] [THINK] Server running at http://127.0.0.1:8360/
[2020-04-26 16:08:39] [THINK] ThinkJS Version: 2.3.0
[2020-04-26 16:08:39] [THINK] Cluster Status: closed
[2020-04-26 16:08:39] [THINK] WebSocket Status: closed
[2020-04-26 16:08:39] [THINK] File Auto Compile: true
[2020-04-26 16:08:39] [THINK] File Auto Reload: true
[2020-04-26 16:08:39] [THINK] App Enviroment: development
访问项目
192.168.1.1:8360