create-payload-app failing to install dependencies (vips/vips8 error)

default discord avatar
jm.svlast year
47

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/1882

but no luck

  • discord user avatar
    dribbens
    last year

    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?

  • default discord avatar
    notchrlast year

    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

  • discord user avatar
    dribbens
    last year

    Running in a docker container could be a good workaround.



    Good thoughts @notchr!

  • default discord avatar
    notchrlast year

    If the issue is on Ubuntu, a related issue on the posted issue claims lib-vips dev was a solution



    apt install libvips-dev
  • default discord avatar
    jm.svlast year

    @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


    https://stackoverflow.com/questions/53022392/installing-sharp-usr-include-vips-vips83525-fatal-error-glib-object-h
  • default discord avatar
    notchrlast year

    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?

  • discord user avatar
    dribbens
    last year
    yarn

    is not required, you should be able to use

    npm

    all the same.

  • discord user avatar
    alessiogr
    last year

    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

  • default discord avatar
    jm.svlast year

    @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

  • discord user avatar
    alessiogr
    last year

    Very weird- I personally never had to install any of that. Xcode tools, nodejs via brew and done

  • default discord avatar
    notchr.islast year

    I'm on a m1 as well which is odd

  • discord user avatar
    alessiogr
    last year

    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

  • default discord avatar
    jm.svlast year

    lol dire times for dire measures, this is driving me crazy

  • discord user avatar
    alessiogr
    last year

    hah it's just like restarting your computer - sometimes more effective than any smart solutions 😅

  • default discord avatar
    jm.svlast year

    @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?

  • discord user avatar
    dribbens
    last year

    I mentioned using docker



    That is still an option



    It is more of a workaround though

  • default discord avatar
    jm.svlast year

    Yeah I'm hoping to avoid that

  • discord user avatar
    dribbens
    last year

    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

  • default discord avatar
    jm.svlast year

    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/Yt6RMK9C
  • discord user avatar
    dribbens
    last year

    Sorry, I wish I knew how to help you out.

  • default discord avatar
    jm.svlast year

    @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

    ?

  • discord user avatar
    dribbens
    last year

    I'm not, but we have others on our team that are. Of course a bunch of other users are also.

  • discord user avatar
    alessiogr
    last year

    oh I'm on an M2, basically the same chip. Never had that issue with the M1 I owned previously as well

  • default discord avatar
    jm.svlast year

    Wowza finally found a solve. Apparantly sharp doesn't like

    /

    in the parent directory.

    https://github.com/lovell/sharp/issues/3703

    Thanks for all the help everyone!

  • discord user avatar
    alessiogr
    last year

    oh interesting! Didn't even know it's possible to have / in directory names

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.