@mingfuyun/star-allinone 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/dist/index.js +1 -2
- package/package.json +3 -3
- package/dist/index.js.LICENSE.txt +0 -87
package/README.md
CHANGED
|
@@ -442,6 +442,56 @@ function Page() {
|
|
|
442
442
|
- Antd >= 5.27.3
|
|
443
443
|
- cron-validator >= 1.4.0 (用于Cron表达式验证)
|
|
444
444
|
|
|
445
|
+
**重要提示**:组件库使用 `peerDependencies` 管理 React 和 Antd,确保你的项目中已安装这些依赖。
|
|
446
|
+
|
|
447
|
+
### 常见问题排查
|
|
448
|
+
|
|
449
|
+
#### 1. "Invalid hook call" 错误
|
|
450
|
+
|
|
451
|
+
如果遇到此错误,请检查:
|
|
452
|
+
|
|
453
|
+
1. 确保项目中只安装了一个 React 版本
|
|
454
|
+
2. 确保 React 和 React-DOM 版本匹配
|
|
455
|
+
3. 如果使用 npm/yarn,可以尝试删除 `node_modules` 和锁文件后重新安装
|
|
456
|
+
4. 如果使用 pnpm,确保在 `.npmrc` 中配置了:
|
|
457
|
+
```ini
|
|
458
|
+
shamefully-hoist=true
|
|
459
|
+
```
|
|
460
|
+
或
|
|
461
|
+
```ini
|
|
462
|
+
public-hoist-pattern[]=*react*
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
#### 2. "Cannot read properties of undefined (reading 'recentlyCreatedOwnerStacks')" 错误
|
|
466
|
+
|
|
467
|
+
这是 React 19 的一个已知问题,可能的原因和解决方案:
|
|
468
|
+
|
|
469
|
+
1. **React 版本问题**:确保使用 React 19.0.0 或更高版本(推荐 19.1.1+)
|
|
470
|
+
2. **多个 React 实例**:确保项目中只有一个 React 实例
|
|
471
|
+
```bash
|
|
472
|
+
# 检查是否有多个 React 实例
|
|
473
|
+
npm ls react
|
|
474
|
+
# 或
|
|
475
|
+
pnpm list react
|
|
476
|
+
```
|
|
477
|
+
3. **pnpm 配置**:如果使用 pnpm,在 `.npmrc` 中添加:
|
|
478
|
+
```ini
|
|
479
|
+
shamefully-hoist=true
|
|
480
|
+
public-hoist-pattern[]=*react*
|
|
481
|
+
public-hoist-pattern[]=*react-dom*
|
|
482
|
+
```
|
|
483
|
+
4. **清除缓存**:尝试清除构建缓存和 node_modules
|
|
484
|
+
```bash
|
|
485
|
+
rm -rf node_modules .next dist build
|
|
486
|
+
npm install
|
|
487
|
+
# 或
|
|
488
|
+
pnpm install
|
|
489
|
+
```
|
|
490
|
+
5. **降级到 React 18**:如果问题持续,可以考虑暂时使用 React 18:
|
|
491
|
+
```bash
|
|
492
|
+
npm install react@^18.0.0 react-dom@^18.0.0
|
|
493
|
+
```
|
|
494
|
+
|
|
445
495
|
## 🔧 开发
|
|
446
496
|
|
|
447
497
|
### 本地开发
|