question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[canary] broken production build for static pages inside Docker

See original GitHub issue

When I try build the project in Ubuntu 18.04 it’s okay. There are only warnings about MaxListeners. But inside the Docker build is failed.

Related packages versions

  • “next”: “9.5.2”
  • “next-optimized-images”: “3.0.0-canary.10”

Tested docker versions:

  • node:12.18.03
  • node:12.18.03-alpine

next build output from docker build:

info  - Creating an optimized production build...
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry

(node:28) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 uncaughtException listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(node:28) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit
info  - Compiled successfully
info  - Collecting page data...
info  - Generating static pages (0/4)

Error occurred prerendering page "/empty". Read more: https://err.sh/next.js/prerender-error
Error: Babel plugin 'react-optimized-image/plugin' not installed or this component could not be recognized by it.
    at Img (/cc-web/node_modules/react-optimized-image/lib/components/Img.js:119:11)
    at d (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:498)
    at $a (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:16)
    at a.b.render (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:476)
    at a.b.read (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
    at renderToString (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:364)
    at Object.renderPage (/cc-web/node_modules/next/dist/next-server/server/render.js:48:686)
    at Function.getInitialProps (/cc-web/.next/server/pages/_document.js:364:19)
    at loadGetInitialProps (/cc-web/node_modules/next/dist/next-server/lib/utils.js:5:101)
    at renderToHTML (/cc-web/node_modules/next/dist/next-server/server/render.js:48:977)

Error occurred prerendering page "/sitemap". Read more: https://err.sh/next.js/prerender-error
Error: Babel plugin 'react-optimized-image/plugin' not installed or this component could not be recognized by it.
    at Img (/cc-web/node_modules/react-optimized-image/lib/components/Img.js:119:11)
    at d (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:498)
    at $a (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:16)
    at a.b.render (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:476)
    at a.b.read (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
    at renderToString (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:364)
    at Object.renderPage (/cc-web/node_modules/next/dist/next-server/server/render.js:48:686)
    at Function.getInitialProps (/cc-web/.next/server/pages/_document.js:364:19)
    at loadGetInitialProps (/cc-web/node_modules/next/dist/next-server/lib/utils.js:5:101)
    at renderToHTML (/cc-web/node_modules/next/dist/next-server/server/render.js:48:977)
info  - Generating static pages (1/4)
info  - Generating static pages (2/4)

Error occurred prerendering page "/404". Read more: https://err.sh/next.js/prerender-error
Error: Babel plugin 'react-optimized-image/plugin' not installed or this component could not be recognized by it.
    at Img (/cc-web/node_modules/react-optimized-image/lib/components/Img.js:119:11)
    at d (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:498)
    at $a (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:16)
    at a.b.render (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:476)
    at a.b.read (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
    at renderToString (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:364)
    at Object.renderPage (/cc-web/node_modules/next/dist/next-server/server/render.js:48:686)
    at Function.getInitialProps (/cc-web/.next/server/pages/_document.js:364:19)
    at loadGetInitialProps (/cc-web/node_modules/next/dist/next-server/lib/utils.js:5:101)
    at renderToHTML (/cc-web/node_modules/next/dist/next-server/server/render.js:48:977)
info  - Generating static pages (3/4)

Error occurred prerendering page "/about". Read more: https://err.sh/next.js/prerender-error
Error: Babel plugin 'react-optimized-image/plugin' not installed or this component could not be recognized by it.
    at Img (/cc-web/node_modules/react-optimized-image/lib/components/Img.js:119:11)
    at d (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:498)
    at $a (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:16)
    at a.b.render (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:476)
    at a.b.read (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
    at renderToString (/cc-web/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:364)
    at Object.renderPage (/cc-web/node_modules/next/dist/next-server/server/render.js:48:686)
    at Function.getInitialProps (/cc-web/.next/server/pages/_document.js:364:19)
    at loadGetInitialProps (/cc-web/node_modules/next/dist/next-server/lib/utils.js:5:101)
    at renderToHTML (/cc-web/node_modules/next/dist/next-server/server/render.js:48:977)
info  - Generating static pages (4/4)

> Build error occurred
Error: Export encountered errors on following paths:
        /404
        /about
        /empty
        /sitemap
    at exportApp (/cc-web/node_modules/next/dist/export/index.js:24:1103)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async build (/cc-web/node_modules/next/dist/build/index.js:37:212)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn build' returned a non-zero code: 1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
meienbergercommented, Oct 2, 2020

Any news about this one ? I cannot build on vercel anymore. Working fine on local machine

1reaction
semyoucommented, Sep 4, 2020

Got the same error when I compile on my production server MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 uncaughtException listeners added to [process]. Use emitter.setMaxListeners() to increase limit (node:28) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit and then I see the process eating up all my servers memory before it crushes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Canary Deployments - GitLab Docs
A Canary Ingress becomes available when you create a new canary deployment and is destroyed when the canary deployment is promoted to production....
Read more >
Testing Container Images Against Multiple Platforms with ...
This post details how to use Container Canary from installation and validation to writing custom manifests and container automation.
Read more >
10 things to avoid in docker containers | Red Hat Developer
First: Containers are immutable - The OS, library versions, configurations, folders, and application are all wrapped inside the container.
Read more >
Docker : Run a React app in a docker - 2020 - BogoToBogo
bogotobogo.com site search: ... To create a production build, use npm run build. ... in our Dockerfile are re-ordered later, the COPY doesn't...
Read more >
Use Compose in production - Docker Documentation
Guide to using Docker Compose in production. ... docker compose build web $ docker compose up --no-deps -d web. This first rebuilds the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found