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.

'sharp' problem..

See original GitHub issue

What version of Next.js are you using?

10.0.5

What version of Node.js are you using?

14

What browser are you using?

Chrome

What operating system are you using?

Docker (node:14-buster)

How are you deploying your application?

next build/start

Describe the Bug

‘sharp’ is not optional during build because of the following code.

https://github.com/vercel/next.js/blob/canary/packages/next/build/index.ts#L413

Expected Behavior

Even in an environment where ‘sharp’ cannot be installed, ‘next build’ should work well.

To Reproduce

$ next build
Loaded env from /usr/src/app/.env
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


> Build error occurred
Error: Cannot find module 'sharp'
Require stack:
- /usr/src/app/node_modules/next/dist/build/index.js
- /usr/src/app/node_modules/next/dist/cli/next-build.js
- /usr/src/app/node_modules/next/dist/bin/next
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.resolve (internal/modules/cjs/helpers.js:94:19)
    at /usr/src/app/node_modules/next/dist/build/index.js:11:866
    at async /usr/src/app/node_modules/next/dist/build/tracer.js:1:525 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/src/app/node_modules/next/dist/build/index.js',
    '/usr/src/app/node_modules/next/dist/cli/next-build.js',
    '/usr/src/app/node_modules/next/dist/bin/next'
  ]
}
error Command failed with exit code 1.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
darrylmabinicommented, Jan 15, 2021

experiencing same issue using Docker (node:14.5.4 LTS)

3reactions
gtolarccommented, Feb 9, 2021

In my case, I had a problem because I forgot to add the node_modules folder to dockerignore. Therefore, the sharp built with darwin was copied to the docker image as it was, preventing a new build for linux. It was my mistake, and as you said, there seems to be no problem if you pre-install libvips for each os. @genemators

Read more comments on GitHub >

github_iconTop Results From Across the Web

sharp problem | English examples in context - Ludwig
High quality example sentences with “sharp problem” in context from reliable sources - Ludwig is the linguistic search engine that helps you to...
Read more >
Sexual Harassment Assault Response Prevention (SHARP)
The Army's Sexual Harassment/Assault Response and Prevention program, known as SHARP, exists so the Army can prevent sexual harassment and sexual assaults ...
Read more >
We Need to Create an Army EO/SHARP Structure that Will ...
The current Army SHARP/EO program structure does not allow career continuation or progression.
Read more >
Issues · lovell/sharp - GitHub
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library. - Issues...
Read more >
GENERAL PROBLEMS - Sharp
(When contacting your dealer or nearest SHARP Service Department, inform them of the displayed error code.) PRINTING IS NOT POSSIBLE OR STOPS DURING...
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