chore:切换包管理器为pnpm(替换yarn)

This commit is contained in:
moyin
2025-12-08 17:21:34 +08:00
parent e973da4efe
commit 5dc97532c6
4 changed files with 31 additions and 15 deletions

View File

@@ -91,33 +91,50 @@ git commit -m "api添加玩家信息查询接口"
## 前置要求
- **Node.js** >= 18.0.0
- **Yarn** >= 1.22.0(推荐)或 npm >= 9.0.0
- **pnpm** >= 8.0.0(推荐)
如果还没有安装 Yarn,请先安装:
如果还没有安装 pnpm,请先安装:
```bash
npm install -g yarn
npm install -g pnpm
```
检查版本:
```bash
node --version
yarn --version
pnpm --version
```
## 安装依赖
```bash
yarn install
pnpm install
```
**注意**首次安装时pnpm 可能会提示需要批准构建脚本。这是 pnpm 的安全特性,用于防止恶意脚本执行。
如果看到以下警告:
```
Warning: Ignored build scripts: @nestjs/core.
Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.
```
请运行以下命令批准 NestJS 的构建脚本:
```bash
pnpm approve-builds
```
然后选择批准 `@nestjs/core` 和其他 NestJS 相关包的构建脚本。
## 开发
启动开发服务器(支持热重载):
```bash
yarn dev
pnpm dev
```
服务器将运行在 `http://localhost:3000`
@@ -125,13 +142,13 @@ yarn dev
## 构建
```bash
yarn build
pnpm build
```
## 生产环境运行
```bash
yarn start:prod
pnpm start:prod
```
## 项目结构