'Gatsby build error (webpack related maybe)
I made a site with gatsby (npm init gatsby) and added some components and was working fine then:
I run npm run develop (after running it before fine) and get this:
failed Building development bundle - 13.532s
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
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
What causes this error and how can I fix this? I'm baffled. Tried with fresh new site and does the same thing.
I upgraded to latest version of node so maybe this has something to do with it. Can anyone help?
Solution 1:[1]
I can confirm that downgrading to node 16 fixes the issue.
Solution 2:[2]
I had the same problem as you.I have downgraded node to the LTS version and it worked!
Solution 3:[3]
had the same issue, downgraded node to 16 and its working fine now,
how to downgrade
$ npm install -g n $ n 6.10.3
how to check version
$ node -v
Solution 4:[4]
Had the same issue on node version 18, when downgraded to node 16.15.0 it worked.
Solution 5:[5]
I used nvm to downgrade from v18.1.0 to v16.5.0. The error is now gone.
More about nvm here.
Solution 6:[6]
I was able to avoid downgrading to Node 16 by following instructions there: https://github.com/gatsbyjs/gatsby/issues/35607
I added this to my package.json:
"resolutions": {
"source-map": "^0.8.0-beta.0"
},
"dependencies": {
"source-map": "^0.8.0-beta.0",
...
Then I did npm install.
After that, I could run npm run develop without any issues.
Solution 7:[7]
try do delete the .cache file and then run npm run develop
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | GavinB |
| Solution 2 | Giacomo |
| Solution 3 | iSoldMyCarForInterntConnection |
| Solution 4 | Kamkan |
| Solution 5 | Saif Ul Islam |
| Solution 6 | MLeb |
| Solution 7 | Karim Elnemr |
