Roots Sage Yarn node-sass Errors

When unpacking old Roots/Sage builds I often have issues with node-sass node versions and getting Yarn to build the project.

Typically, after typing ‘yarn’ on the cli to install the dependencies, it does it’s best until it attempts the node-sass package then stalls before printing screens of error messages. culminating in something like this:

.node-gyp/12.18.0/include/node/v8.h:3135:5: note:   candidate expects 2 arguments, 1 provided
make: Leaving directory '/localhostserver/project/node_modules/node-sass/build'
make: *** [binding.target.mk:131: Release/obj.target/binding/src/create_string.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/localhostserver/project/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.4.0-19041-Microsoft
gyp ERR! command "../versions/node/v12.18.0/bin/node" "/localhostserver/project/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /localhostserver/project/node_modules/node-sass
gyp ERR! node -v v12.18.0

The gist of that is: node-sass says No!

After much to-ing and fro-ing and finding a solution and forgetting it and then finding the problem again months later, here is the super quick fix. Ensure Node is on a compatible version (nvm current), something like v12.18.0

  1. Open package.lock
  2. Find the line for “node-sass”
  3. Update the version to “~4.13.0”
  4. Save & try ‘Yarn’ again..

Leave a Reply