I've decided that node-sass is too picky to write a blog post for each quirk so I'm adding them all here.
When the node-sass version defined in package-lock.json is too old and no longer available on github (currently v3)
- Upgrade node-sass version to ^4.13.0 (from ^3.2.0 or similar)
- Upgrade gulp-sass version to ^3.2.1 (from ^2.2.0 or similar)
- Run
npm audit
fix to ensure compatibility - Delete node_modules folder (optional)
- Run
npm install
to update the package-lock.json
January 21st 2021
So I’m happily following instructions on a new-to-me website build to get it to run locally. All seems straight-forward.
Clone repo, install composer things, yarn things, run some script to get the site build and another thing if I’m making CSS changes. Cool, I can do this!
After running yarn install
I get a bunch of error messages saying I needed to update node to get node-sass to work so I did (by going to https://nodejs.org/en/ and downloading the latest package)
I ran yarn instal again and got the following error
`Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (57)``
From pervious experience I assumed I needed to run npm rebuild node-sass
after updating the Node version
BUT, I got more errors.
npm ERR! Failed at the node-sass@4.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
After some loops of insanity, trying the same steps over and over… (What’s that Einstein saying?!) I installed to node v10.23.1. The yarn error message originally told me to install node greater than or equal to (>=) version 10 and I assumed the latest version was ok but nooooo obviously not, that’s too easy!
I deleted node_modules and any lock files which had been made/amended since cloning my repo just to be sure I wasn’t forcing anything to download the wrong versions again…
I ran npm rebuild node-sass
and got a response of
Testing binary
Binary is fine
Well that’s comforting at least, so I and ran yarn install
again followed the rest of my sites install steps and MAGIC, I now have a working site. 50 minutes later!
Remember those days when it was just HTML and CSS… (ok, fine and tables and flash and inaccessible code and no version control but COME ON! I just wanted to change some CSS!)