gridsome: sharp: Command failed

Description

env

  1. win7 64
  2. node@10.15.x
  3. npm@6.4.1
  4. yarn@1.15.1
  5. python@3.7.x

Steps to reproduce

  1. gridsome create my-gridsome-site. error report:
Error: Failed to install dependencies with yarn  Please enter my-gridsome-site directory and install dependencies with yarn or npm manually.
 Exit code 1
 at ChildProcess.child.on.code...
...
  1. cd my-gridsome-site
  2. yarn install. error report:
error E:\my-gridsome-site\node_modules\sharp: Command failed.
Command: (node install/libvips && node install/dll-copy && prebuild-install) ||
(node-gyp rebuild && node install/dll-copy)
...

why?

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 15
  • Comments: 68 (5 by maintainers)

Most upvoted comments

So after some digging/searching and trying these steps solved it for me:

rm -rf /Users/{username}/.npm/_libvips brew install vips // If this command throws some error about could not download cfitsio, just ignore. rm -rf node_modules npm install

Summary of mentions as above (it doesn’t work for me at all)

  • $ rm -rf /Users/{username}/.npm/_libvips
  • $ brew install vips

You should try downgrade node to stable version

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

v13.10.1 -> v12.16.1

https://www.hostingadvice.com/how-to/update-node-js-latest-version/

OK, I’m having luck with npm rebuild then re-running npm install. I feel like I’ve done exactly that a couple of times, but this last time, it seemed to take. Oh, and I also downgraded my Node to v10.16.0 and NPM is v6.9.0, that seems to be getting me through.

Have you tried to run npm install or yarn install from within your project directory?

I tried, but it still didn’t work.

I’m having the same issue now after trying to reinstall. Could it be a sharp issue?

Is there no other solution than downgrading to a (much) older version of Node?

Same error after upgrade !! OS: ArchLinux

Resolved by :

  • switch to v10.16.0 with NVM
  • delete node_modules
  • run npm install

@alainib Version 10.16 of nodejs does not give any errors. It would be better to switch to this version when using gridsome.

There is an tool : NVM(Node Version Manager) that allows to easily switch from one version of nodejs to another per project.

  • Just install it and switch to version 10.16 of nodejs,
  • remove the node_modules folder from your project
  • redo an npm install under version 10.16 of nodejs.

Downgrading to node 10.16.0 via NVM did the trick for me

I literally tried all the answers, regardless of breaking my repository and it doesn’t work

Until it occurred to me to downgrade Nodejs v15.7.0 to Node v12.6.0 and it worked perfectly

Having same issues. Doesnt matter if i use the CLI or install from inside the dir.

OSX 10.14.5 Node v12.6 or v10.16.0 NPM 6.9.0. Yarn 1.17.3

Running npm rebuild didn’t help either.

Fails on sharp@0.22.1 install, fatal error: ‘vips/vips8’ file not found

For me downgrading node from 16.x to 14.x solved the issue.

It looks Gridsome is pretty much dead @shershen08 I would not bet on anything getting fixed anymore

For some people it worked to downgrading to node 14 instead of 10 but I’m still struggling to get this worked on M1 chip

@alainib Version 10.16 of nodejs does not give any errors. It would be better to switch to this version when using gridsome.

There is an tool : NVM(Node Version Manager) that allows to easily switch from one version of nodejs to another per project.

  • Just install it and switch to version 10.16 of nodejs,
  • remove the node_modules folder from your project
  • redo an npm install under version 10.16 of nodejs. Works for me, thank you very much

nvm use 10

npm ci

profit

After trying everything, nothing worked for me, finally just changed the node version to 10.16 and it works!

It may be relevant that the brew install vips command never seems to resolve for me. It always either fails to start, or hangs somewhere. It never gives me a success message (or an error, for that matter; it just goes silent as though it’s stuck running forever).

It doesn’t work for me OSX 10.15.1 Node v13.0.1 NPM 6.12.1 Yarn 1.19.2

Gridsome is pretty much dead

I think the above sums up this thread pretty accurately. I tried many workarounds, including downgrading Node to v14 and such, but those were not future-proof enough and produced other random problems.

I ended up replacing Gridsome with Vue 3 and Vite, and to anyone who can take the liberty of doing that just like I could, I recommend you do the same.

any fix please ?

Can we remove the dependence on sharp and libvips? vips is a hefty dependency to carry, in that on Linux this dependency is so big it’s a nightmare (and often doesn’t work because libvips is a nightmare source to begin with) and I’m not a big fan of having to install a thousand dependencies that I’ll never use.

So after some digging/searching and trying these steps solved it for me:

rm -rf /Users/{username}/.npm/_libvips brew install vips // If this command throws some error about could not download cfitsio, just ignore. rm -rf node_modules npm install

@u12206050 , this seems to be a solution if you’re on a Mac.

Any solution for Windows? I’m getting the same “python” error (made a thread here) that another guy up top was getting. I’ve had this project for almost two years and suddenly when trying to run the project last week, I get the Python error.

I haven’t been able to start this project since.

The thing that finally worked for me was to install sharp myself. Doesn’t feel like a great workaround, and yarn still spits out a ton of deprecation warnings when I run it, but at least my site is back accessible again after several hours.

npm install sharp