我在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/feed/feeds/atom.xml.xml
这是回购: https://github.com/freelawproject/freelawproject/free.law 上述部署是从主分支中
的带FIX-RSS分支的站点:(我在此分支中更改了原子URL)并没有丢下错误,但是我的feed是空的,而不是从帖子文件夹显示读取的MDX文件。
该提要在本地上正常工作,还可以正确地将帖子加载到供稿上。
我不是下一个。JS专家,但我已经解决了很多问题,但没有找到解决方案。
I’m having problems with a deploy on Netlify. The Next.js projects builds and deploy correctly except from one part that uses feed package, when I try to access to feed it always throws this error:
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
The project uses Next.js 12.1.0
You can see error here: https://free.law/feeds/atom.xml
This the repo: https://github.com/freelawproject/free.law the deploy above is from main branch
I also tried to deploy to another site with fix-rss branch here: https://deploy-preview-84--cozy-raindrop-954cef.netlify.app/feeds/all.atom.xml (I changed atom url in this branch) Here doesn’t throw the error but my feed is empty instead of display the read mdx files from posts folder.
The feed works correctly on local, also loads the post on the feed correctly.
I'm not an next.js expert but I've reseached a lot but haven't found a solution.
发布评论
评论(1)
您最有可能使用 @netlify/plugin-nextjs的V3。这不再是维护或支持。您应该升级到V4解决问题。在此处阅读迁移指南: https://github.com/netlify/netlify-plugin-nextjs#migrating-from-ander-ander-version-of-the-plugin
You're most likely using v3 of @netlify/plugin-nextjs. This is no longer maintained or supported. You should upgrade to v4 to solve the issue. Read the migration guide here: https://github.com/netlify/netlify-plugin-nextjs#migrating-from-an-older-version-of-the-plugin