Search code examples
npmgulpgulp-sass

Gulp error when running: Gulp-sass no longer has a default Sass compiler; please set one yourself


I am getting the following error message when trying to run my gulp script.

` gulp-sass no longer has a default Sass compiler; please set one yourself. Both the "sass" and "node-sass" packages are permitted. For example, in your gulpfile:

const sass = require('gulp-sass')(require('sass')); `

Versions being used are:

"devDependencies": { "gulp-sass": "^5.1.0", "sass": "^1.63.6" }

npm: 9.5.1 node: 18.16.0 gulp: CLI version: 2.3.0 Local version: 3.9.1

Edit: Upgrading gulp is not an option since it isn't my code. It is NetSuite code and upgrading would be a large task since there are so many scripts.

To fix the issue between gulp and node breaking I have: "overrides": { "graceful-fs": "^4.2.11" }, and I install with: npm i --ignore-scripts

I have tried doing as it suggests as well as the other option I have seen in another thread. Neither of which have helped and I am very stuck on what to do as I don't have a great understanding of gulp and don't know where to look. Error description suggestion Alternative

---- Update -----

I have answered my question below and accepted the answer.


Solution

  • After some further investigation, I worked it out!

    The problem was I was placing that code in my gulpfile.js which is different from where sass was being used; it was being used 3 tasks deeper which made it difficult to find.

    I needed to place the declaration there.

    @Alexander's answer above I believe is the better solution which is to upgrade to gulp v4, however as I responded in that question upgrading wasn't an option since it isn't my code base.