Skip to content

安装payloadcms到本地运行发现SCSS 样式文件导入失败 #16159

@deqiuwangshi-png

Description

@deqiuwangshi-png

Describe the Bug.

需要确认样式冲突问题,报错500

Reproduction Steps

Bug 复现步骤模板

环境信息

- **操作系统**: Windows 11
- **Next.js 版本**: 16.2.1
- **Payload CMS 版本**: 3.81.0

复现步骤

  1. 初始化项目

    git clone <repository-url>
    cd xiangfeng
    pnpm install
  2. 启动开发服务器

    pnpm dev
    #
    npm run dev
  3. 访问页面

    • 打开浏览器访问 http://localhost:3000
  4. 触发错误

    • 页面加载时出现 500 错误
    • 终端显示 SCSS 编译错误:
      Error: Can't find stylesheet to import.
      @import 'vars';
      

预期行为

页面正常加载,AdminBar 组件正确渲染。

实际行为

页面返回 500 错误,SCSS 编译失败。

截图

Image

相关代码

// src/components/AdminBar/index.scss (问题文件)
@import '~@payloadcms/ui/scss';

.admin-bar {
  @include small-break {
    display: none;
  }
}

Environment Info

最新版本

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: uiRelated to the admin panel.status: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions