I would like to create a new Gatsby site using the instructions on https://www.gatsbyjs.com/docs/quick-start , so I ran:
npm init gatsby # see note below
cd my-gatsby-site
npm run develop
Note: I didn't change any configuration, so I'm using JavaScript (instead of TypeScript), not using a CMS, not using a styling system, and installed no additional features.
During running npm run develop
, I'm getting the following error:
> [email protected] develop
> gatsby develop
success compile gatsby files - 0.812s
success load gatsby config - 0.020s
success load plugins - 0.198s
success onPreInit - 0.001s
success initialize cache - 0.121s
success copy gatsby files - 0.113s
success Compiling Gatsby Functions - 0.277s
success onPreBootstrap - 0.294s
success createSchemaCustomization - 0.001s
success Checking for changed pages - 0.001s
success source and transform nodes - 0.065s
success building schema - 0.143s
success createPages - 0.008s
success createPagesStatefully - 0.044s
info Total nodes: 24, SitePage nodes: 4 (use --verbose for breakdown)
success Checking for changed pages - 0.001s
success write out redirect data - 0.041s
success onPostBootstrap - 0.002s
info bootstrap finished - 5.190s
success onPreExtractQueries - 0.002s
success extract queries from components - 0.082s
success write out requires - 0.005s
success run page queries - 0.017s - 3/3 174.40/s
ERROR #98123 WEBPACK
Generating development JavaScript bundle failed
You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({
'lib/mappings.wasm': ... }) before using SourceMapConsumer
File: .cache/app.js
ERROR #98123 WEBPACK
Generating development JavaScript bundle failed
You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({
'lib/mappings.wasm': ... }) before using SourceMapConsumer
File: .cache/polyfill-entry.js
failed Building development bundle - 8.585s
ERROR in ./.cache/app.js
Module build failed (from
./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js):
Error: You must provide the URL of lib/mappings.wasm by calling
SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
at readWasm
(/Users/xfq/test/gatsby-test/my-gatsby-site/node_modules/source-map/lib/read-wasm.js:8:13)
at wasm
(/Users/xfq/test/gatsby-test/my-gatsby-site/node_modules/source-map/lib/wasm.js:25:16)
at /Users/xfq/test/gatsby-test/my-gatsby-site/node_modules/source-map/lib/source-map-co
nsumer.js:264:14
at Object._loader (/Users/xfq/test/gatsby-test/my-gatsby-site/node_modules/@pmmmwh/reac
t-refresh-webpack-plugin/loader/index.js:81:9)
ERROR in ./.cache/polyfill-entry.js
Module build failed (from
./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js):
Error: You must provide the URL of lib/mappings.wasm by calling
SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
at readWasm
(/Users/xfq/test/gatsby-test/my-gatsby-site/node_modules/source-map/lib/read-wasm.js:8:13)
at wasm
(/Users/xfq/test/gatsby-test/my-gatsby-site/node_modules/source-map/lib/wasm.js:25:16)
at /Users/xfq/test/gatsby-test/my-gatsby-site/node_modules/source-map/lib/source-map-co
nsumer.js:264:14
at Object._loader (/Users/xfq/test/gatsby-test/my-gatsby-site/node_modules/@pmmmwh/reac
t-refresh-webpack-plugin/loader/index.js:81:9)
develop compiled with 2 errors
success Writing page-data.json files to public directory - 0.099s - 3/4 40.45/s
Environment:
node 18.3.0
npm 8.11.0
OS: macOS 12.4
I'm not sure how to debug this problem. Can anyone point me in the right direction?
CodePudding user response:
This issue is related to your Node version (^18.0
).
The issue should be resolved if you downgrade to 16, deleting your node_modules
, your package-lock.json
and reinstalling them again.
If that's not an option if you need to stick to version 18 use the following resolution in your package.json
:
"resolutions": {
"source-map": "^0.8.0-beta.0"
},
Another solution is upgrading Gatsby to its latest version by:
npm install gatsby@next
More details can be found at: https://github.com/gatsbyjs/gatsby/issues/35607