YApi is where the network of large open source front-end technology center a visual interface management platform. The following step is to build a second development environment under CentOS7.
1 install MongoDB
DETAILED installation reference CentOS7 mounting MongoDB
Installation Node.js and npm 2
Refer to the specific installation mounted on CentOS nvm
Node.js version 7.6.0, npm version than 5.0
View Node.js version
node -v
View npm version
asl -v
3 departments yapi
Yapi mkdir CD Yapi Git = --depth clone https://github.com/YMFE/yapi.git vendors. 1 // or downloaded to extract the zip package vendors directory cp vendors / config_example.json ./config.json // the copy is complete Please modify the configuration cd vendors npm install --production --registry https://registry.npm.taobao.org // installation depends npm run install-server // initialize the database index installer and administrator account, the administrator account name can be configured in config.json
3.1 Creating the project directory
Yapi mkdir CD Yapi Git = --depth clone https://github.com/YMFE/yapi.git vendors. 1 // or downloaded to extract the zip package vendors directory
3.2 modify the configuration file
After the copy is complete // cp vendors / config_example.json ./config.json modify the configuration vi ./config.json
The following configuration changes, the main configuration database MongoDB:
{ "port": "3011", "adminAccount": "[email protected]", "db": { "servername": "10.228.129.235", "DATABASE": "yapi", "port": 27017, "authSource": "" }, "mail": { "enable": true, "host": "smtp.163.com", "port": 465, "from": "***@163.com", "auth": { "user": "***@163.com", "pass": "*****" } } }
3.3 install dependencies
vendors CD NPM // installation depends the install --registry https://registry.npm.taobao.org
3.4 Initialization
npm run install-server // initialize the database index installer and administrator account, the administrator can configure the account name config.json
3.5 start the development machine
To start the development server environment, execute the following command:
npm run dev // After starting the server, please visit 127.0.0.1:{config.json port configuration}, the initial run will be a compilation process, please be patient
4 installation package tool
Installation webpack
npm install -g webpack // global install npm install --save-dev webpack // install directory project
Installation ykit
npm install ykit -g
! If the installation process, there npm ERR error, the solution is as follows:
npm install ykit -g --unsafe-perm=true --allow-root
5 packed with ykit execution
ykit pack -m
If the packaging process, the emergence directory permissions Permission denied error, the solution is as follows:
chmod 777 file or directory
After the package is successful, it will generate the compressed file in the following vendors / static / prd folder:
6 start production environment servers
node server/app.js
After the service starts successfully, the following message appears:
7 service running in the background
Use the following command:
nohup node server/app.js &
View the process
ps aux
Kill the process
kill -9 pid specific number
8 issues
ykit Packaging Success, after starting production server, open a browser error:
The reason given: the secondary development environment does not support windows, please secondary development on CentOS or MacOS environment.