0

From Command Prompt I am able to execute node-sass and convert scss to css

D:\> node-sass test.scss testout.css 

works and works correctly.

But...

When I am writing a program in electron ( need to dynamically convert a scss string to css string )

  var sass = require('node-sass');

  var output = sass.renderSync({
    data: Some_SCSS_Content
  });

I get an error as below:

(node:96852) UnhandledPromiseRejectionWarning: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (80)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.9.4
    at module.exports (D:\OASDEV\electron-quick-start\node_modules\node-sass\lib\binding.js:13:13)
    at Object.<anonymous> (D:\OASDEV\electron-quick-start\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:967:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1004:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)

On searching I found that this might be due to compatibility issues with Node Version.

Ref: Error: Node Sass does not yet support your current environment: Windows 64-bit with false

I have Node 10.18.1 and Node-sass version 4.9.4. They are compatible.

Further on I tried rebuild

npm rebuild node-sass

But that did not work either.

Another I tried changing version of Node-sass , tried 4.14 and 4.12 also.

It really stumps me that why it works from terminal and not in another Node program.

DragonZoned
  • 201
  • 3
  • 14

1 Answers1

0

Node-sass doesn't currently support running in Electron. They are both V8 based runtimes, but have different ABI versions from NodeJs. Support might be added in v5 of node-sass

nschonni
  • 4,069
  • 1
  • 28
  • 37