deploying with sharp
Answered
Cinnamon posted this in #help-forum
CinnamonOP
hi, i'm using sharp, not only for next-image but also directly on the back end. To build, it requires i run
yarn add sharp --ignore-engines . That works fine locally. When i deploy to vercel it still asks for this, i tried creating a package.json script "postinstall": "yarn add sharp --ignore-engines" but that runs recursively when i do yarn install19 Replies
on vercel you dont need to install sharp
vercel has it installed default
you can install it and have it referenced in your package.json so you can use sharp in your codebase
bit it will install it as a default to optimise images
CinnamonOP
ok. I am using sharp in my codebase
the page fails and the logs tell me to do a
yarn add sharp --ignore-engines or the likethats weird, whats the error itself?
CinnamonOP
Error: Could not load the "sharp" module using the linux-x64 runtime
Possible solutions:
- Ensure optional dependencies can be installed:
npm install --include=optional sharp
yarn add sharp --ignore-engines
- Ensure your package manager supports multi-platform installation:
See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
npm install --os=linux --cpu=x64 sharp
- Consult the installation documentation:
See https://sharp.pixelplumbing.com/install
at Object.<anonymous> (/var/task/node_modules/sharp/lib/sharp.js:114:9)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at /opt/rust/nodejs.js:1:11497
at Function.Lt (/opt/rust/nodejs.js:1:11867)
at G.e.<computed>.z._load (/opt/rust/nodejs.js:1:11467)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at require (node:internal/modules/helpers:177:18)
Node.js process exited with exit status: 1. The logs above can help with debugging the issue.
Possible solutions:
- Ensure optional dependencies can be installed:
npm install --include=optional sharp
yarn add sharp --ignore-engines
- Ensure your package manager supports multi-platform installation:
See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
npm install --os=linux --cpu=x64 sharp
- Consult the installation documentation:
See https://sharp.pixelplumbing.com/install
at Object.<anonymous> (/var/task/node_modules/sharp/lib/sharp.js:114:9)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at /opt/rust/nodejs.js:1:11497
at Function.Lt (/opt/rust/nodejs.js:1:11867)
at G.e.<computed>.z._load (/opt/rust/nodejs.js:1:11467)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at require (node:internal/modules/helpers:177:18)
Node.js process exited with exit status: 1. The logs above can help with debugging the issue.
might be related to you
CinnamonOP
that suggested two solutions: downgrade the sharp version (which works for me yaay). But also they say "please ensure @vercel/nft version 0.26.1 or later is being used - see vercel/nft#371 for details." I have no clue how to do that
i mean, if it works it works aye
lemme see the other thread one sec
CinnamonOP
yes thank you, you were a great help. I spent a few hours mucking with it before coming to the discord.
no worries, mark a solution
went through the thread btw, they dont really seem to have gotten an answer
went through the thread btw, they dont really seem to have gotten an answer
CinnamonOP
mark a solution?
Original message was deleted
@Cinnamon
Carpenter wasp
i don't get it
how it solved