Gatsby: Reinstalling packages to the last version gives an file not found error

Created on 11 Sep 2019  Â·  7Comments  Â·  Source: gatsbyjs/gatsby

Description

Describe the issue that you're seeing.

I just run the npm install command and got an error output on my terminal, it was working perfectly last week.

Here is my package.json dependencies:

https://github.com/cassianomon/cassianomon.github.io/blob/develop/package.json

"dependencies": {
    "browserslist": "^4.7.0",
    "@emotion/core": "^10.0.17",
    "@emotion/styled": "^10.0.17",
    "gatsby": "^2.15.14",
    "gatsby-cli": "^2.7.47",
    "gatsby-image": "^2.2.18",
    "gatsby-plugin-google-analytics": "^2.1.16",
    "gatsby-plugin-manifest": "^2.2.16",
    "gatsby-plugin-offline": "^3.0.6",
    "gatsby-plugin-react-helmet": "^3.1.7",
    "gatsby-plugin-sass": "^2.1.14",
    "gatsby-plugin-sharp": "^2.2.21",
    "gatsby-source-filesystem": "^2.1.22",
    "gatsby-transformer-sharp": "2.1.19",
    "node-sass": "^4.12.0",
    "prop-types": "^15.7.2",
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "react-helmet": "^5.2.1"
  },
  "devDependencies": {
    "babel-eslint": "10.0.3",
    "cpx": "^1.5.0",
    "eslint-plugin-prettier": "3.1.0",
    "gatsby-plugin-root-import": "^2.0.5",
    "gh-pages": "^2.1.1",
    "prettier": "^1.18.2",
    "prettierrc": "0.0.0-5"
  },

Steps to reproduce

Clear steps describing how to reproduce the issue. Please please please link to a demo project if possible, this makes your issue _much_ easier to diagnose (seriously).

Expected result

What should happen?

To start development server

Actual result

What happened.

Terminal output the error below:

> [email protected] install /Users/cassiano/Dropbox/Dev/gh-page/node_modules/fsevents
> node install

node-pre-gyp WARN Using request for node-pre-gyp https download 
[fsevents] Success: "/Users/cassiano/Dropbox/Dev/gh-page/node_modules/fsevents/lib/binding/Release/node-v72-darwin-
x64/fse.node" is installed via remote

> [email protected] install /Users/cassiano/Dropbox/Dev/gh-page/node_modules/gatsby-transformer-sharp/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy
)

info sharp Using cached /Users/cassiano/.npm/_libvips/libvips-8.7.4-darwin-x64.tar.gz

> [email protected] install /Users/cassiano/Dropbox/Dev/gh-page/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy
)

info sharp Using cached /Users/cassiano/.npm/_libvips/libvips-8.8.1-darwin-x64.tar.gz
ERR! sharp Please delete /Users/cassiano/.npm/_libvips/libvips-8.8.1-darwin-x64.tar.gz as it is not a valid tarball
ERR! sharp zlib: unexpected end of file
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/page/install for required dependencies
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:25:10: fatal error: 'vips/vips8' file not found
#include <vips/vips8>
         ^~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:196:2
3)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/Cellar/node/12.3.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bi
n/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/cassiano/Dropbox/Dev/gh-page/node_modules/sharp
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok 
npm WARN [email protected] requires a peer of [email protected] but none is installed. You mus
t install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >=
 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must instal
l peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@* but none is installed. You must install peer dependencies you
rself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp re
build && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/cassiano/.npm/_logs/2019-09-11T03_21_52_105Z-debug.log

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

  System:
    OS: macOS 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.3.1 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
  Languages:
    Python: 2.7.15 - /usr/local/bin/python
  Browsers:
    Chrome: 77.0.3865.75
    Firefox: 67.0.4
    Safari: 12.1.2
  npmPackages:
    gatsby: ^2.15.14 => 2.15.14 
    gatsby-cli: ^2.7.47 => 2.7.47 
    gatsby-image: ^2.2.18 => 2.2.18 
    gatsby-plugin-google-analytics: ^2.1.16 => 2.1.16 
    gatsby-plugin-offline: ^3.0.6 => 3.0.6 
    gatsby-plugin-react-helmet: ^3.1.7 => 3.1.7 
    gatsby-plugin-root-import: ^2.0.5 => 2.0.5 
    gatsby-plugin-sass: ^2.1.14 => 2.1.14 
    gatsby-source-filesystem: ^2.1.22 => 2.1.22 
    gatsby-transformer-sharp: 2.1.19 => 2.1.19 
  npmGlobalPackages:
    gatsby-cli: 2.6.2
question or discussion

Most helpful comment

Fixed with gatsby-plugin-sharp => "2.2.14", shouldn't the gatsby new run with this version as default until it get fixed?

If so, I would love to make a pull request for it 😄

All 7 comments

Your issue is not directly related to Gatsby but your installation of the sharp dependencies. Please try running npm rebuild, deleting your node_modules folder and running npm install again.

Your issue is not directly related to Gatsby but your installation of the sharp dependencies. Please try running npm rebuild, deleting your node_modules folder and running npm install again.

Well, it comes along with Gatsby gatsby new MyAwesomeProject, so I think it's related to Gatsby.

Done what you told me and now I have this output and the project won't start:

➜  gh-page git:(develop) ✗ npm start           

> [email protected] start /Users/cassiano/Dropbox/Dev/gh-page
> npm run develop


> [email protected] develop /Users/cassiano/Dropbox/Dev/gh-page
> gatsby develop

success open and validate gatsby-configs - 0.047 s
â ‹ load plugins

(sharp:31406): GLib-GObject-WARNING **: 09:18:26.388: cannot register existing type 'VipsObject'

(sharp:31406): GLib-CRITICAL **: 09:18:26.388: g_once_init_leave: assertion 'result != 0' failed

(sharp:31406): GLib-GObject-CRITICAL **: 09:18:26.388: g_type_register_static: assertion 'parent_type > 0' failed

(sharp:31406): GLib-CRITICAL **: 09:18:26.389: g_once_init_leave: assertion 'result != 0' failed

When running gatsby new you're cloning the default starter which contains among other things also two sharp plugins. As people in this issue https://github.com/gatsbyjs/gatsby/issues/16957 you likely have multiple, conflicting versions of libvips installed (also mentioned here: https://github.com/lovell/sharp/issues/1725)

Fixed with gatsby-plugin-sharp => "2.2.14", shouldn't the gatsby new run with this version as default until it get fixed?

If so, I would love to make a pull request for it 😄

I know, no one wants to hear the infamous "it works on my machine", but as we mentioned in the linked issue the problem doesn't exist because of the sharp plugin, but outdated libvips version – that's also the reason why gatsby new works for me just fine. Therefore we shouldn't change the version in the default starter.

We're marking this issue as answered and closing it for now but please feel free to reopen this and comment if you would like to continue this discussion. We hope we managed to help and thank you for using Gatsby!

I just experienced this too, on my first gatsby new, https://github.com/gatsbyjs/gatsby/issues/17545#issuecomment-530847247 indeed fixes it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KyleAMathews picture KyleAMathews  Â·  3Comments

totsteps picture totsteps  Â·  3Comments

jimfilippou picture jimfilippou  Â·  3Comments

ferMartz picture ferMartz  Â·  3Comments

rossPatton picture rossPatton  Â·  3Comments