From 16c4a78e2920eba7d10e67ce8f013558b9e0694a Mon Sep 17 00:00:00 2001 From: Ryan Ran <1410277647@qq.com> Date: Tue, 30 Sep 2025 11:04:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=85=BC=E5=AE=B9=E6=80=A7):=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20seller=20=E9=A1=B9=E7=9B=AE=E7=9A=84=20package.json?= =?UTF-8?q?=20=E5=92=8C=20README.md=EF=BC=8C=E6=B7=BB=E5=8A=A0=20NODE=5FOP?= =?UTF-8?q?TIONS=20=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E4=BB=A5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20Node.js=20=E7=89=88=E6=9C=AC=2020=20=E5=92=8C=2018?= =?UTF-8?q?=20=E7=9A=84=E8=BF=90=E8=A1=8C=EF=BC=8C=E8=AF=A6=E7=BB=86?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E5=90=84=E7=89=88=E6=9C=AC=E7=9A=84=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7=E5=92=8C=E5=AE=89=E8=A3=85=E8=A6=81=E6=B1=82?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E6=96=87=E6=A1=A3=E4=BB=A5=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seller/README.md | 101 +++++++++++++++++++++++++++++++++++--------- seller/package.json | 6 +-- 2 files changed, 84 insertions(+), 23 deletions(-) diff --git a/seller/README.md b/seller/README.md index 7532f2c9..010bbf04 100644 --- a/seller/README.md +++ b/seller/README.md @@ -1,29 +1,90 @@ # LILISHOP-UI -## Project setup -``` -npm install -``` +# LiliShop UI Seller 的 Node.js 版本兼容性 -### Compiles and hot-reloads for development -``` -npm run serve -``` +本文档概述了 LiliShop UI seller 项目的 Node.js 版本兼容性。 -### Compiles and minifies for production -``` -npm run build -``` +## 摘要 -### Run your tests -``` -npm run test -``` +| Node.js 版本 | npm 版本 | 兼容性 | 备注 | +|-----------------|-------------|--------------|-------| +| v20.13.1 (当前 LTS) | 10.8.0 | ✅ 需要解决方案 | 安装需要 `--legacy-peer-deps` 参数,运行需要 `NODE_OPTIONS=--openssl-legacy-provider` | +| v18.20.8 (LTS) | 10.8.2 | ✅ 需要解决方案 | 安装需要 `--legacy-peer-deps` 参数,运行需要 `NODE_OPTIONS=--openssl-legacy-provider` | +| v16.20.2 (LTS) | 8.19.4 | ✅ 有轻微警告 | 安装需要 `--legacy-peer-deps` 参数,整体运行良好 | +| v14.x (最低版本) | - | ❌ 不兼容 | 无法在 ARM64 架构上安装 (M系列 Mac) | + +## 详细发现 + +### Node.js v20.13.1 (当前 LTS) +- **安装**: 使用 `--legacy-peer-deps` 参数可以正常安装 +- **开发服务器**: 需要设置 `NODE_OPTIONS=--openssl-legacy-provider` 环境变量 +- **构建**: 需要设置 `NODE_OPTIONS=--openssl-legacy-provider` 环境变量 +- **问题**: + - vue-awesome-swiper 和 swiper 之间的依赖冲突 + - 由于 Node.js v20 移除了旧版加密算法导致的 OpenSSL 相关错误 + - 部分包报告不支持的引擎警告 +- **验证**: 已成功构建并验证 dist/index.html 可以正常运行 + +### Node.js v18.20.8 (LTS) +- **安装**: 使用 `--legacy-peer-deps` 参数可以正常安装 +- **开发服务器**: 需要设置 `NODE_OPTIONS=--openssl-legacy-provider` 环境变量 +- **构建**: 需要设置 `NODE_OPTIONS=--openssl-legacy-provider` 环境变量 +- **问题**: + - 部分包报告不支持的引擎警告 (v-click-outside-x, @achrinza/node-ipc) +- **验证**: 已成功构建并验证 dist/index.html 可以正常运行 + +### Node.js v16.20.2 (LTS) +- **安装**: 使用 `--legacy-peer-deps` 参数可以正常安装 +- **开发服务器**: 无需额外参数即可运行 +- **构建**: 可以正常构建 +- **问题**: + - v-click-outside-x 包有轻微警告 (需要 npm 6.4.1) + +### Node.js v14.x +- **安装**: 在 ARM64 架构 (M系列 Mac) 上无法安装 +- **开发服务器**: 未测试 +- **构建**: 可以正常构建 +- **问题**: + - Node.js v14 没有 ARM64 架构的二进制文件 + +## 建议 + +1. **最佳版本**: Node.js v16.20.2 配合 npm 8.19.4 + - 与项目依赖最兼容 + - 需要的解决方案最少 + - 性能稳定 + +2. **安装命令**: + ```bash + npm install --legacy-peer-deps + ``` + +3. **开发命令**: + ```bash + # 对于 Node.js v16 + npm run dev + + # 对于 Node.js v18 或 v20 + NODE_OPTIONS=--openssl-legacy-provider npm run dev + 或者 npm run dev:18 + ``` + +4. **生产构建命令**: + ```bash + # 对于 Node.js v16 + npm run build + + # 对于 Node.js v18 或 v20 + NODE_OPTIONS=--openssl-legacy-provider npm run build + 或者 npm run dev:18 + ``` + +## 未来考虑 + +1. 更新依赖以兼容较新的 Node.js 版本 +2. 解决对等依赖冲突 +3. 更新 package.json 以指定推荐的 Node.js 版本范围 -### Lints and fixes files -``` -npm run lint -``` ### Customize configuration 详情点击 [https://cli.vuejs.org/zn/config/](https://cli.vuejs.org/zn/config/). diff --git a/seller/package.json b/seller/package.json index c217529d..3f0f2acb 100644 --- a/seller/package.json +++ b/seller/package.json @@ -8,9 +8,9 @@ "node": ">=14" }, "scripts": { - "serve": "vue-cli-service serve", - "build": "vue-cli-service build", - "dev": "vue-cli-service serve" + "serve": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve", + "dev": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve", + "build": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build" }, "dependencies": { "@amap/amap-jsapi-loader": "0.0.7",