[strapi]从版本 4.11.3 开始,Strapi 项目在升级时出现构建错误

2024-05-13 87 views
3
  • Node.js 版本:16.13.1
  • NPM版本:8.1.2
  • 斯特拉皮版本:4.11.4
  • 数据库:MySQL
  • 操作系统:MacOs Ventura 13.4.1
  • 您的项目是 Javascript 还是 Typescript:JavaScript
描述错误

已遵循官方 Strapi 升级说明,并且能够安装所需的软件包,但当我在开发模式下构建项目时,出现错误,如下所示。

重现行为的步骤
  1. 将 package.json 中的 Strapi 版本升级到最新的 4.11.4
  2. 删除.cache目录、node_modules和package-lock.json
  3. 运行npm install然后npm run build
  4. 请参阅日志中下面的错误
预期行为

Strapi 正常构建项目。

代码片段
ModuleNotFoundError: Module not found: Error: Can't resolve 'ee_else_ce/pages/AuthPage/utils/forms' in '/Users/marcopolo/Documents/marcopolo-cms/.cache/admin/src/pages/AuthPage'
    at /Users/marcopolo/Documents/marcopolo-cms/node_modules/webpack/lib/Compilation.js:2022:28
    at /Users/marcopolo/Documents/marcopolo-cms/node_modules/webpack/lib/NormalModuleFactory.js:817:13
    at eval (eval at create (/Users/marcopolo/Documents/marcopolo-cms/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /Users/marcopolo/Documents/marcopolo-cms/node_modules/webpack/lib/NormalModuleFactory.js:275:22
    at eval (eval at create (/Users/marcopolo/Documents/marcopolo-cms/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /Users/marcopolo/Documents/marcopolo-cms/node_modules/webpack/lib/NormalModuleFactory.js:448:22
    at /Users/marcopolo/Documents/marcopolo-cms/node_modules/webpack/lib/NormalModuleFactory.js:118:11
    at /Users/marcopolo/Documents/marcopolo-cms/node_modules/webpack/lib/NormalModuleFactory.js:689:25
    at /Users/marcopolo/Documents/marcopolo-cms/node_modules/webpack/lib/NormalModuleFactory.js:893:8
    at /Users/marcopolo/Documents/marcopolo-cms/node_modules/webpack/lib/NormalModuleFactory.js:1013:5
resolve 'ee_else_ce/pages/AuthPage/utils/forms' in '/Users/marcopolo/Documents/marcopolo-cms/.cache/admin/src/pages/AuthPage'
  Parsed request is a module
  using description file: /Users/marcopolo/Documents/marcopolo-cms/.cache/package.json (relative path: ./admin/src/pages/AuthPage)
    aliased with mapping 'ee_else_ce': '/Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin' to '/Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms'
      using description file: /Users/marcopolo/Documents/marcopolo-cms/.cache/package.json (relative path: ./admin/src/pages/AuthPage)
        Field 'browser' doesn't contain a valid alias configuration
        root path /Users/marcopolo/Documents/marcopolo-cms
          using description file: /Users/marcopolo/Documents/marcopolo-cms/package.json (relative path: ./Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/marcopolo/Documents/marcopolo-cms/Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/marcopolo/Documents/marcopolo-cms/Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
              /Users/marcopolo/Documents/marcopolo-cms/Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.jsx doesn't exist
            .react.js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/marcopolo/Documents/marcopolo-cms/Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.react.js doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /Users/marcopolo/Documents/marcopolo-cms/Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /Users/marcopolo/Documents/marcopolo-cms/Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.tsx doesn't exist
            as directory
              /Users/marcopolo/Documents/marcopolo-cms/Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms doesn't exist
        using description file: /Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/package.json (relative path: ./pages/AuthPage/utils/forms)
          no extension
            Field 'browser' doesn't contain a valid alias configuration
            /Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms doesn't exist
          .js
            Field 'browser' doesn't contain a valid alias configuration
            /Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.js doesn't exist
          .jsx
            Field 'browser' doesn't contain a valid alias configuration
            /Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.jsx doesn't exist
          .react.js
            Field 'browser' doesn't contain a valid alias configuration
            /Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.react.js doesn't exist
          .ts
            Field 'browser' doesn't contain a valid alias configuration
            /Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.ts doesn't exist
          .tsx
            Field 'browser' doesn't contain a valid alias configuration
            /Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms.tsx doesn't exist
          as directory
            /Users/marcopolo/Documents/marcopolo-cms/node_modules/@strapi/admin/pages/AuthPage/utils/forms doesn't exist
额外的背景信息

我们的项目使用的是 v4.7.1,在升级之前我们正在等待 GraphQL 分页错误修复,因为我们的项目依赖于此功能,因此我们尝试直接升级到 v4.11.4,并在日志中收到上述错误。然后我们尝试使用 v4.11.3 并得到相同的结果。但是,从 v4.11.2 及更低版本开始,我们可以正常构建项目。

回答

9

我会尝试清除该.cache文件夹?

2

我会尝试清除该.cache文件夹?

我们每次都这样做但没有成功:(

1

我会尝试清除该.cache文件夹?

我们每次都这样做但没有成功:(

我还会尝试清除您的节点模块 - 如果这不能帮助删除您的锁定文件,简而言之,此文件 -/Users/marcopolo/Documents/marcopolo-cms/.cache/admin/src/pages/AuthPage不是我们甚至不再使用该导入的实际 4.11.4 发行版本?

4

我会尝试清除该.cache文件夹?

我们每次都这样做但没有成功:(

我还会尝试清除您的节点模块 - 如果这不能帮助删除您的锁定文件,简而言之,此文件 -/Users/marcopolo/Documents/marcopolo-cms/.cache/admin/src/pages/AuthPage不是我们甚至不再使用该导入的实际 4.11.4 发行版本?

正如重现步骤部分中所述,我们目前正在安装和构建之前删除锁定文件、节点模块和 .cache 文件夹 - 但在尝试构建时仍然遇到相同的错误。我刚刚又尝试了一次。有什么想法可能是什么问题吗?例如,当我在 4.11.2 中执行相同操作时,它可以构建,但从 4.11.3 开始,我得到与上面相同的错误。

7

只是想确认一下你们使用的是社区版还是企业版?

8

社区

5

@gabba196 您使用/制作的任何插件或扩展吗?

7

@Boegie19 是的 - 3 个自定义插件和对默认 Strapi 用户权限的一些修改,但这些从 v4 到 v4.11.2 一直对我们有用。除此之外,我们在构建时遇到错误。

6

@Boegie19你可以制作一个应用程序的临时/测试版本,其中包含所有不由stapi维护的插件并删除所有修改,看看是否可以解决你的问题?

8

这是一条模板消息

你好@gabba196,

感谢您报告此错误,但是根据我们现有的信息,我们无法重现您所描述的问题。您能否创建一个能够在其中重现该问题的新项目,提供重现此问题的明确步骤,并将此新项目上传到新的 GitHub 存储库,或者将其压缩为.zip并上传到此问题?

我们非常感谢您对此的帮助,通过在一个新项目中工作,它将消除任何可能不相关的变量。请注意,status: can not reproduce如果没有任何活动,标记为 的问题将在 14 天内关闭。

谢谢你!

2

从我们这边更新:似乎我们需要手动添加 AuthPages 的 useEnterprise() 挂钩并替换 ee_else_ce ,这样就成功了。能够构建成功

4

@gabba196 只是为了确认您使用的扩展/插件之一,所以这不是一个 Strapi 问题?

6

@gabba196 只是为了确认您使用的扩展/插件之一,所以这不是一个 Strapi 问题?

是的,我现在可以确认这一点。