Skip to content

Visual platform deployment ​

1. Configure and install dependencies ​

Edit .env.development in the project root and configure the backend API address.

js
# 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.

shell
# Install pnpm.
npm install -g pnpm
shell
# Install project dependencies.

# pnpm, recommended. Use a suitable registry mirror when needed.
pnpm install

# npm
npm install

# yarn
yarn install

2. Build the project ​

shell
# pnpm
pnpm run build

# npm
npm run build

# yarn
yarn run build

# makefile
make dist

3. Deploy the project ​

Add a location block to the Nginx configuration. Do not use duplicate matching keywords. Upload the compiled files to:

text
/var/data/nginx/view/

Nginx example:

nginx
location ^~/view/ {
  alias /var/data/nginx/view/;
  index index.html;
  try_files $uri $uri/ /index.html last;
}

After deployment, access the visual platform at:

text
https://[domain]/view/

You can also add it as an external-link menu in the system.

text
https://iot.fastbee.cn/view/#/project/items

4. Add a menu entry ​

提示

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:

text
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: Normal

Replace 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 install fails or the project cannot run, use pnpm.

pnpm setup example:

shell
# 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 taobao

6. FAQ ​

6.1 const open = require('open') error when running nrm ls ​

Install a compatible open package, then run nrm ls again.

shell
npm i nrm -g open@8.4.2 --save
nrm ls

6.2 Node.js memory limit ​

Check the current heap limit:

shell
node -e "console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))"

Increase the memory limit when needed:

shell
export NODE_OPTIONS="--max-old-space-size=8192"

Common values are 2048, 4096, 8192, and 16384.

FastBee | fastbee.cn