我想使用https://www.gatsbyjs.com/docs/quick-start上的說明創建一個新的 Gatsby 站點,所以我運行了:
npm init gatsby # see note below
cd my-gatsby-site
npm run develop
注意:我沒有更改任何配置,所以我使用的是 JavaScript(而不是 TypeScript),沒有使用 CMS,沒有使用樣式系統,也沒有安裝任何附加功能。
在運行期間npm run develop,我收到以下錯誤:
> my-gatsby-site@1.0.0 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
環境:
node 18.3.0
npm 8.11.0
OS: macOS 12.4
我不確定如何除錯這個問題。誰能指出我正確的方向?
uj5u.com熱心網友回復:
此問題與您的 Node 版本 ( ^18.0) 有關。
node_modules如果您降級到 16、洗掉您的、您的package-lock.json并重新安裝它們,該問題應該會得到解決。
如果您需要堅持使用版本 18,那么這不是一個選項,請在您的 中使用以下解決方案package.json:
"resolutions": {
"source-map": "^0.8.0-beta.0"
},
另一個解決方案是通過以下方式將 Gatsby 升級到最新版本:
npm install gatsby@next
更多詳細資訊可以在以下位置找到:https ://github.com/gatsbyjs/gatsby/issues/35607
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/485977.html
標籤:javascript 反应 网页包 盖茨比
