[英]Cannot deploy Next.js to Netlify. Deploy failed due to an error in @netlify/plugin-nextjs plugin
[英]Netlify Next.js deploy error: Cannot find module ‘esbuild’
我在 Netlify 上進行部署時遇到問題。 Next.js 項目可以正確構建和部署,但使用 feed 包的部分除外,當我嘗試訪問 feed 時,它總是會拋出此錯誤:
Runtime.ImportModuleError: Error: Cannot find module 'esbuild'
Require stack:
- /var/task/.netlify/functions-internal/next_feeds_atomxml/nextPage/chunks/708.js
- /var/task/.netlify/functions-internal/next_feeds_atomxml/nextPage/webpack-runtime.js
- /var/task/.netlify/functions-internal/next_feeds_atomxml/nextPage/pages/feeds/atom.xml.js
- /var/task/.netlify/functions-internal/next_feeds_atomxml/next_feeds_atomxml.js
- /var/task/next_feeds_atomxml.js
- /var/runtime/UserFunction.js
- /var/runtime/Runtime.js
- /var/runtime/index.js
at _loadUserApp (/var/runtime/UserFunction.js:221:13)
at Object.module.exports.load (/var/runtime/UserFunction.js:279:17)
at Object.<anonymous> (/var/runtime/index.js:43:34)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
at internal/main/run_main_module.js:17:47
項目使用 Next.js 12.1.0
你可以在這里看到錯誤: https ://free.law/feeds/atom.xml
這是回購: https ://github.com/freelawproject/free.law 上面的部署來自主分支
我還嘗試在此處使用 fix-rss 分支部署到另一個站點: https ://deploy-preview-84--cozy-raindrop-954cef.netlify.app/feeds/all.atom.xml(我在此更改了 atom url分支)這里不會拋出錯誤,但我的提要是空的,而不是顯示從帖子文件夾中讀取的 mdx 文件。
提要在本地正常工作,也可以正確加載提要上的帖子。
我不是 next.js 專家,但我研究了很多,但沒有找到解決方案。
您最有可能使用 @netlify/plugin-nextjs 的 v3。 這不再被維護或支持。 您應該升級到 v4 以解決該問題。 在此處閱讀遷移指南: https ://github.com/netlify/netlify-plugin-nextjs#migrating-from-an-older-version-of-the-plugin
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.