- Node.js 版本:16.13.1
- NPM版本:8.1.2
- 斯特拉皮版本:4.11.4
- 数据库:MySQL
- 操作系统:MacOs Ventura 13.4.1
- 您的项目是 Javascript 还是 Typescript:JavaScript
已遵循官方 Strapi 升级说明,并且能够安装所需的软件包,但当我在开发模式下构建项目时,出现错误,如下所示。
重现行为的步骤- 将 package.json 中的 Strapi 版本升级到最新的 4.11.4
- 删除.cache目录、node_modules和package-lock.json
- 运行
npm install
然后npm run build
- 请参阅日志中下面的错误
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 及更低版本开始,我们可以正常构建项目。