Kevin Ramirez Zavalza
Kevin Ramirez Zavalza

Reputation: 1785

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

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.

Upvotes: 1

Views: 882

Answers (1)

Hrishikesh Kokate
Hrishikesh Kokate

Reputation: 1225

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

Upvotes: 2

Related Questions