Visual platform deployment
1. Configure and install dependencies
Edit .env.development in the project root and configure the backend API address.
# Backend API address.
VITE_DEV_PATH = 'http://localhost:8080'Install dependencies. pnpm is recommended to avoid unnecessary dependency installation errors. Node.js 16.14.x is recommended.
# Install pnpm.
npm install -g pnpm# Install project dependencies.
# pnpm, recommended. Use a suitable registry mirror when needed.
pnpm install
# npm
npm install
# yarn
yarn install2. Build the project
# pnpm
pnpm run build
# npm
npm run build
# yarn
yarn run build
# makefile
make dist3. Deploy the project
Add a location block to the Nginx configuration. Do not use duplicate matching keywords. Upload the compiled files to:
/var/data/nginx/view/Nginx example:
location ^~/view/ {
alias /var/data/nginx/view/;
index index.html;
try_files $uri $uri/ /index.html last;
}After deployment, access the visual platform at:
https://[domain]/view/You can also add it as an external-link menu in the system.
https://iot.fastbee.cn/view/#/project/items4. Add a menu entry
Tips
The FastBee commercial version includes a built-in large-screen dashboard and visual platform. They can be accessed from the IoT platform by adding menu entries.
Visual platform menu:
System Management -> Menu Management -> Add
Parent menu: Data visualization
Menu type: Menu
Menu icon: monitor
Menu name: Visual platform
External link: Yes
Sort order: 2
Route address: https://iot.fastbee.cn/view
Cache: Yes
Display status: Show
Menu status: NormalReplace iot.fastbee.cn with your own server address.
5. Notes
- Use Node.js v16.14.x or later. v16.14.2 is recommended.
- If
npm installfails or the project cannot run, usepnpm.
pnpm setup example:
# 1. Install pnpm.
npm install -g pnpm
# 2. Install nrm.
npm install -g nrm
# 3. Add a registry mirror.
nrm add taobao https://registry.npmmirror.com/
# 4. List registry mirrors.
nrm ls
# 5. Use the registry mirror.
nrm use taobao6. Common issues
6.1 const open = require('open') error when running nrm ls
Install a compatible open package, then run nrm ls again.
npm i nrm -g open@8.4.2 --save
nrm ls6.2 Node.js memory limit
Check the current heap limit:
node -e "console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))"Increase the memory limit when needed:
export NODE_OPTIONS="--max-old-space-size=8192"Common values are 2048, 4096, 8192, and 16384.
