Search code examples
intellij-ideaversion-controlfile-watcher

Error compiling scss using sass in intellij filewatchers


I have followed this tutorial: https://www.jetbrains.com/help/idea/transpiling-sass-less-and-scss-to-css.html#install_sass_scss and created a file watcher for my scss file. Picture of file watcher settings in intellij

Using node.js version 14.15.1

The error message in console:

cmd.exe /D /C call C:\Users\***\AppData\Roaming\npm\sass.cmd main.scss:main.css
C:\Users\***\AppData\Roaming\npm\node_modules\sass\node_modules\chokidar\index.js:3
const { EventEmitter } = require('events');
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\Inni\AppData\Roaming\npm\node_modules\sass\sass.dart.js:116:17)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

Process finished with exit code 1

Any help is greatly appreciated! Thanks.


Solution

  • What Node.js version do you use? Looks as if it's outdated and doesn't support even basic ES6 syntax. Sass requires Node.js 10 or higher, see https://github.com/sass/dart-sass#nodejs-compatibility