This is my first Gist, so probably it's not the correct way of doing things.
I recently encountered a problem, so this is what happened:
-
I follow a tutorial on how to create a website using Gatsby, but got stucked when adding the gatsby-plugin-sharp
-
On minute 3:03:30 of the video we have to install three plugins to work with images:
install npm install gatsby-plugin-sharp gatsby-remark-images gatsby-remark-relative-images
- When trying to
npm run develop
a weird error shows
Something went wrong installing the "sharp" module
.../sharp.node is not a valid Win32 application.
-
I tried everything I found online, but nothing worked. So I thought on installing a basic starter that already displays an image to see if the problem was on my project, on my computer or something else. I did it, but when running
npm run develop
the same problem showed. Weird. -
I tried uninstalling node, installing the 32-bit version, the 64-bit version, etc.
-
By the way, I have Windows 10 with Intel Core i7-8550U CPU @ 1.80GHz, I use Visual Studio Code.
-
On the next day I found out about this:
npm-check
-
First, I installed it with
npm install -g npm-check
-
Then I ran
npm-check
to see there was a react and react-DOM major upgrade -
I ran
npm-check -u
which gives you the option to upgrade everything that needs to be upgraded, so I selected both options and upgraded them -
When I ran
npm run develop
I found another problem:
Node Sass could not find a binding for your current environment: Windows 32-bit with Node.js 14.x
This usually happens because your environment has changed since running
npm install
.
Run
npm rebuild node-sass
to download the binding for your current environment.
- So I did ran
npm rebuild node-sass
- I closed Visual Studio Code and opened again (I really tried everything) and ran
npm run develop
and Voilà! It works! - I went to my http://localhost:8000/ and the site is working and the image is there.