this is going to be a tricky one to explain because so much has gone wrong all at once. I was working on a Gatsby site and decided to update gatsby-cli
, so I typed (if I remember right) something like npm update -g gatsby
(which isn't the right command). I got a message to the effect that about 800 packages had been deleted. When I tried running gatsby develop
, the gatsby
command was no longer recognised. Then I realised npm
itself had been wiped. So I ran brew install node
and managed to reinstall npm
and gatsby-cli
. But I've been trying to get the development server up and running again for hours to no avail.
Unfortunately it's hard to be very specific about what's going wrong, because I'm getting so many different error messages. For context, I'm using an M1 (Apple silicon) Mac with Node running natively. I encountered some problems with installing gatsby-plugin-sharp
specifically, which seemed linked to my install of Xcode. There also seem to be issues with node-sass
, which is where I'm currently at.
Right now, if I try running npm install
in the directory of my Gatsby site, I get hundreds of lines of errors, which I've copied here.
I've already tried without success:
package_lock.json
All the other Gatsby sites on my machine are throwing similar errors. Sorry this is such a vague question, and happy to supply more details. Any help appreciated.
Reinstalling your node probably causes this. it seems like node-gyp is giving you problems with your node version, You can try using https://github.com/nvm-sh/nvm and downgrade your node version.
I still run my gatsby v3 sites on node v.12 and everything works fine.