Starting a blank project, the
npx create-payload-app
command worked, but it didn't install the local dependencies. When running
npm i
from the project's directory, it fails when installing the
sharp
package due to a
vips/vips8
error.
I tried the resolution from this related thread in the sharp repository:
https://github.com/lovell/sharp/issues/1882but no luck
I'm trying to reproduce this right now.
Just the default options of
npx create-payload-app
worked, that is using yarn
I'll test with npm next
I happen to be on node
18.14.1
yarn
1.22.19
and npm
9.3.1
No issues with
npm
install either
My go-to solution for deps issues is always to delete
node_modules
and try again. Have you done that already?
Are you on osx?
On some operating systems, like older OSX, you need to manually install lib-vips via homebrew
otherwise sharp cant build
Newer OSX doesn't have the issue, not sure why, I think because it comes with lib-vips maybe?
If you're on a different OS, not sure if it's related, but you could try to manually install lib-vips
Running in a docker container could be a good workaround.
Good thoughts @notchr!
If the issue is on Ubuntu, a related issue on the posted issue claims lib-vips dev was a solution
apt install libvips-dev
@notchr I'm on Mac OS Ventura 13.1. From that related issue I tried adding to
resolutions
in package.json but got the same issue. @dribbens I did try deleting node_modules and I've re-tried the
npx create-payload-app
a few times and fails each time.
I tried
npm cache verify
as well to check my global npm cache and that came back okay.
Sounds like maybe trying to homebrew install lib-vips is what I should try next?
@dribbens also I don't have
yarn
installed. Could that be an issue? Assuming not since you said npm worked for you
Alrighty installing got past that error, but introduced another:
npm ERR! /usr/local/include/vips/vips8:35:10: fatal error: 'glib-object.h' file not found
npm ERR! #include <glib-object.h>
Going down a rabbithole with sharp / vips install issues, will report back
Did you install vips from homebrew?
That's how I had to install vips when I was on an older version of OSX
Also, what version of node are you on?
yarn
is not required, you should be able to use
npm
all the same.
I had the exact same error yesterday
The problem was that I used Node 20
When switching back to Node 18, error was gone
Tried all the other approaches, like installing vips, alpine build tools etc. as well, nothing worked. Maybe the sharp/node-gyp version we're using isn't compatible with Node 20
Though locally it works - just had the issue on Docker
@notchr.is yep from Homebrew. @alessiogr I'm on Node
v18.16.0
. I just tried chasing down all the vips and sharp errors I could, reinstalled xcode cli tools (per this thread
https://stackoverflow.com/questions/67560211/mac-m1-something-went-wrong-installing-the-sharp-module/67566332#67566332) but still no luck
Very weird- I personally never had to install any of that. Xcode tools, nodejs via brew and done
I'm on a m1 as well which is odd
I'd personally try uninstalling nodejs and everything else you installed (vips, etc), delete payload, then fresh install node, enable corepack, clone payload and try again with yarn.
.. who knows, maybe that fixes it magically
lol dire times for dire measures, this is driving me crazy
hah it's just like restarting your computer - sometimes more effective than any smart solutions 😅
@alessiogr dang, still no luck. Completely uninstalled node, reinstalled. Tried with npm and yarn. @dribbens do you have any other ideas of what I could try?
I mentioned using docker
That is still an option
It is more of a workaround though
Yeah I'm hoping to avoid that
Are you able to isolate the issue by making a new node project with just sharp in your dependencies and see if it installs on an empty project otherwise
Good idea, let me try
Yeah that doesn't work either, same error. So confusing though because in this instance it looks like the sharp install is correctly fetching its own version of libvips directly from their github repo
https://share.cleanshot.com/Yt6RMK9CSorry, I wish I knew how to help you out.
@dribbens that's alright, appreciate the help. I'm wondering if it's an M1 issue. If you (or @alessiogr if you're on mac os) if you run
arch
in your terminal, do you see
arm64
or
i386
?
I'm not, but we have others on our team that are. Of course a bunch of other users are also.
oh I'm on an M2, basically the same chip. Never had that issue with the M1 I owned previously as well
Wowza finally found a solve. Apparantly sharp doesn't like
/
in the parent directory.
https://github.com/lovell/sharp/issues/3703Thanks for all the help everyone!
oh interesting! Didn't even know it's possible to have / in directory names
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.