Hello,
I am having the following error when trying to build my project on version 2.8.0 and above:
WARNING in ./node_modules/@payloadcms/db-mongodb/dist/createMigration.js 44:33-51
Critical dependency: the request of a dependency is an expression
@ ./node_modules/@payloadcms/db-mongodb/dist/index.js 18:25-53
@ ./src/payload.config.ts 3:0-57 78:8-23
@ ./node_modules/payload/dist/admin/Root.js
@ ./node_modules/payload/dist/admin/index.js 9:53-70
WARNING in ./node_modules/payload/dist/database/migrations/readMigrationFiles.js 35:26-43
Critical dependency: the request of a dependency is an expression
@ ./node_modules/payload/database.js 223:28-84
@ ./node_modules/@payloadcms/db-mongodb/dist/index.js 13:18-45
@ ./src/payload.config.ts 3:0-57 78:8-23
@ ./node_modules/payload/dist/admin/Root.js
@ ./node_modules/payload/dist/admin/index.js 9:53-70
2 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
ERROR in ./node_modules/@payloadcms/db-mongodb/dist/createMigration.js 11:51-64
Module not found: Error: Can't resolve 'fs' in '/Users/vitalystarush/Desktop/vstarush/Spinsoft/Platform/template-backend/node_modules/@payloadcms/db-mongodb/dist'
@ ./node_modules/@payloadcms/db-mongodb/dist/index.js 18:25-53
@ ./src/payload.config.ts 3:0-57 78:8-23
@ ./node_modules/payload/dist/admin/Root.js
@ ./node_modules/payload/dist/admin/index.js 9:53-70
ERROR in ./node_modules/payload/dist/database/migrations/createMigration.js 11:51-64
Module not found: Error: Can't resolve 'fs' in '/Users/vitalystarush/Desktop/vstarush/Spinsoft/Platform/template-backend/node_modules/payload/dist/database/migrations'
@ ./node_modules/payload/database.js 214:25-78
@ ./node_modules/@payloadcms/db-mongodb/dist/index.js 13:18-45
@ ./src/payload.config.ts 3:0-57 78:8-23
@ ./node_modules/payload/dist/admin/Root.js
@ ./node_modules/payload/dist/admin/index.js 9:53-70
ERROR in ./node_modules/payload/dist/database/migrations/readMigrationFiles.js 11:51-64
Module not found: Error: Can't resolve 'fs' in '/Users/vitalystarush/Desktop/vstarush/Spinsoft/Platform/template-backend/node_modules/payload/dist/database/migrations'
@ ./node_modules/payload/database.js 223:28-84
@ ./node_modules/@payloadcms/db-mongodb/dist/index.js 13:18-45
@ ./src/payload.config.ts 3:0-57 78:8-23
@ ./node_modules/payload/dist/admin/Root.js
@ ./node_modules/payload/dist/admin/index.js 9:53-70
ERROR in ./node_modules/prompts/dist/elements/prompt.js 3:17-36
Module not found: Error: Can't resolve 'readline' in '/Users/vitalystarush/Desktop/vstarush/Spinsoft/Platform/template-backend/node_modules/prompts/dist/elements'
@ ./node_modules/prompts/dist/elements/text.js 9:15-34
@ ./node_modules/prompts/dist/elements/index.js 4:14-31
@ ./node_modules/prompts/dist/prompts.js 5:11-32
@ ./node_modules/prompts/dist/index.js 19:16-36
@ ./node_modules/prompts/index.js 13:6-32
@ ./node_modules/@payloadcms/db-mongodb/dist/migrateFresh.js 12:56-74
@ ./node_modules/@payloadcms/db-mongodb/dist/index.js 32:22-47
@ ./src/payload.config.ts 3:0-57 78:8-23
@ ./node_modules/payload/dist/admin/Root.js
@ ./node_modules/payload/dist/admin/index.js 9:53-70
ERROR in ./node_modules/prompts/lib/elements/prompt.js 3:17-36
Module not found: Error: Can't resolve 'readline' in '/Users/vitalystarush/Desktop/vstarush/Spinsoft/Platform/template-backend/node_modules/prompts/lib/elements'
@ ./node_modules/prompts/lib/elements/toggle.js 2:15-34
@ ./node_modules/prompts/lib/elements/index.js 6:16-35
@ ./node_modules/prompts/lib/prompts.js 3:11-32
@ ./node_modules/prompts/lib/index.js 3:16-36
@ ./node_modules/prompts/index.js 14:6-31
@ ./node_modules/@payloadcms/db-mongodb/dist/migrateFresh.js 12:56-74
@ ./node_modules/@payloadcms/db-mongodb/dist/index.js 32:22-47
@ ./src/payload.config.ts 3:0-57 78:8-23
@ ./node_modules/payload/dist/admin/Root.js
@ ./node_modules/payload/dist/admin/index.js 9:53-70
5 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.89.0 compiled with 5 errors and 2 warnings in 7437 ms
Version 2.7.0 builds correctly.
When I try to resolveAlias(serverOnlyModules, ['fs', 'readline', 'util'])
it fixes the errors and works correctly on the localhost.
However, when I deploy to Heroku, the dasboard does not load and just shows a blank screen.
Would appreciate any thoughts or help! Thank you.
When you updated Payload did you also update the version of the bundler and database packages?
We should be handling the aliasing in the core packages appropriately.
On a new create-payload-app you should expect to get:
payload@2.11.2
@payloadcms/db-mongodb@1.4.3
@payloadcms/bundler-webpack@1.0.6
If you still have issues after verifying these versions are installed, let me know or open a new issue for somebody to take a closer look.
Thanks!
Awesome! Thank you Dan! that solved it :)
For future reference, when the new version comes out, where can I check if the dependencies need to be updated? And how do I know which version of dependencies to use?
Thank you!
Awesome! Thank you Dan! that solved it :)
You're welcome!
For future reference, when the new version comes out, where can I check if the dependencies need to be updated? And how do I know which version of dependencies to use?
This won't be a problem after Payload v3. We are moving to publishing all packages with the same release version as payload.
Until then you can look at the release notes: github.com/payloadcms/payload/releases
Star
Discord
online
Get dedicated engineering support directly from the Payload team.