简体   繁体   English

Netlify Next.js 部署错误:找不到模块“esbuild”

[英]Netlify Next.js deploy error: Cannot find module ‘esbuild’

I'm having problems with a deploy on Netlify.我在 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: 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

The project uses Next.js 12.1.0项目使用 Next.js 12.1.0

You can see error here: https://free.law/feeds/atom.xml你可以在这里看到错误: https ://free.law/feeds/atom.xml

This the repo: https://github.com/freelawproject/free.law the deploy above is from main branch这是回购: https ://github.com/freelawproject/free.law 上面的部署来自主分支

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.我还尝试在此处使用 fix-rss 分支部署到另一个站点: https ://deploy-preview-84--cozy-raindrop-954cef.netlify.app/feeds/all.atom.xml(我在此更改了 atom url分支)这里不会抛出错误,但我的提要是空的,而不是显示从帖子文件夹中读取的 mdx 文件。

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.我不是 next.js 专家,但我研究了很多,但没有找到解决方案。

You're most likely using v3 of @netlify/plugin-nextjs.您最有可能使用 @netlify/plugin-nextjs 的 v3。 This is no longer maintained or supported.这不再被维护或支持。 You should upgrade to v4 to solve the issue.您应该升级到 v4 以解决该问题。 Read the migration guide here: https://github.com/netlify/netlify-plugin-nextjs#migrating-from-an-older-version-of-the-plugin在此处阅读迁移指南: https ://github.com/netlify/netlify-plugin-nextjs#migrating-from-an-older-version-of-the-plugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM