3 Error: Cannot find module 'webpack/lib/RuleSet' 问题
yangjianbing edited this page 2026-02-06 14:40:00 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Node.js 依赖彻底清理与重装指南

请根据您使用的包管理器npm / yarn / pnpm执行以下流程

1. 彻底清理与重新安装程序

# --- 步骤 1: 删除 node_modules 和 锁定文件 ---
rm -rf node_modules
rm -f package-lock.json  # 如果使用 npm
# rm -f yarn.lock        # 如果使用 yarn
# rm -f pnpm-lock.yaml   # 如果使用 pnpm

# --- 步骤 2: 清理缓存 (解决包损坏或冲突) ---
npm cache clean --force  # 如果使用 npm
# yarn cache clean       # 如果使用 yarn
# pnpm store prune       # 如果使用 pnpm

# --- 步骤 3: 重新安装依赖 ---
npm install              # 如果使用 npm
# yarn install           # 如果使用 yarn
# pnpm install           # 如果使用 pnpm

# --- 步骤 4: 重新编译
拷贝resources下必要的文件夹到node_modules下然后执行
npm run build