Open SergioMaurySterling opened 11 months ago
Hello SergioMaurySterling
Thank you for reporting this issue. From the error message provided, it seems that there's a conflict between ES Modules (require()
) and CommonJS (import()
), specifically with the usage of remark-mdx
.
To resolve this, the error message suggests changing the require()
call to a dynamic import()
in the affected file server.js
within gatsby-recipes
:
From:
var remarkMdx = require('remark-mdx');
To:
var remarkMdx = import('remark-mdx');
Please attempt this modification and check if it resolves the issue. If the problem persists or if you encounter related errors, please let us know. Additionally, ensure to review other parts of the codebase for similar incompatibilities.
Let me know if you need further assistance.
Best regards, Riza
Preliminary Checks
Description
Gatsby project
Comments> The project is using NPM, cannot be changed to yarn, it will imply in multiple other errors/issues.
The error> sams@192 project % npm run start
/Users/sams/Desktop/project/node_modules/gatsby-recipes/dist/graphql-server /server.js:52 var remarkMdx = require('remark-mdx'); ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/sams/Desktop/project/node_modules/remark-mdx/index.js from /Users/sams/Desktop/project/nodemodules/gatsby-recipes/dist/graphql-server /server.js not supported. Instead change the require of index.js in /Users/sams/Desktop/project/node modules/gatsby-recipes/dist/graphql-server/server.js to a dynamic import() which is available in all CommonJS modules. at Object. (/Users/sams/Desktop/project/node_modules/gatsby-
recipes/dist/graphql-server/server.js:52:17) {
code: 'ERR_REQUIRE_ESM'
}
success open and validate gatsby-configs - 0.125s success load plugins - 0.996s success onPreInit - 0.065s success initialize cache - 0.017s success copy gatsby files - 0.064s success onPreBootstrap - 0.024s success createSchemaCustomization - 0.008s success Checking for changed pages - 0.005s success source and transform nodes - 0.315s
ERROR
Missing onError handler for invocation 'building-schema', error was 'Error: Cannot create as TypeComposer the following value: Date.'. Stacktrace was 'Error: Cannot create as TypeComposer the following value: Date. at SchemaComposer.createTempTC (/Users/sams/Desktop/project/node_module s/graphql-compose/lib/SchemaComposer.js:365:11) at SchemaComposer.addAsComposer (/Users/sams/Desktop/project/node_modul es/graphql-compose/lib/SchemaComposer.js:563:27) at createSchemaComposer (/Users/sams/Desktop/project/node_modules/gatsb y/src/schema/schema-composer.js:16:18) at build (/Users/sams/Desktop/project/node_modules/gatsby/src/schema/in dex.js:104:26) at buildSchema (/Users/sams/Desktop/project/node_modules/gatsby/src/ser vices/build-schema.ts:19:3)'
⠇ building schema
Reproduction Link
https://codesandbox.io/p/devbox/github/gatsbyjs/gatsby-starter-minimal
Steps to Reproduce
Expected Result
Project running on port localhost:8000
Actual Result
Missing onError handler for invocation 'building-schema', error was 'Error: Cannot create as TypeComposer the following value: Date.'. Stacktrace was 'Error: Cannot create as TypeComposer the following value: Date.
Environment
Config Flags
plugins: [ 'gatsby-plugin-react-helmet', { resolve: 'gatsby-source-filesystem', options: { name: 'images', path:
${__dirname}/src/images
, }, }, 'gatsby-transformer-sharp', 'gatsby-plugin-sharp', { resolve: 'gatsby-plugin-manifest', options: { name: 'gatsby-starter-default', short_name: 'starter', start_url: '/', display: 'minimal-ui', icon: 'src/images/favicon-logo.png', }, }, ],