node-sass: Problem with using node-sass alongside electron on Ubuntu 16.04

I am using node-sass alongside electronin Ubuntu 16.04. When I run electron . inside my project, I get following error:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (49)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v3.8.0

There is no problem, however, when I run the same command on Ubuntu 15.04.

I have latest version of node and node-sass (at the time of posting this issue).

Any idea?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (4 by maintainers)

Commits related to this issue

Most upvoted comments

We actually could rebuild node-sass against Electron version. I’m successfully rebuild with following steps :

  1. Follow these steps https://github.com/sass/node-sass#rebuilding-binaries until npm install don’t need to run last step (node scripts/build -f)
  2. In node-sass directory run following : HOME=~/.electron-gyp ./node_modules/node-gyp/bin/node-gyp.js rebuild --target=1.3.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= – Note that I’m using Electron version 1.3.4, you can change with your Electron version.
  3. The output will be inside build/Release/binding.node Then you can copy that file into your node_modules/node-sass/vendor/darwin-x64-49 folder. – Note that I’m using darwin-x-64-49, you should match this with your environment. Mine is : OSX 64bit with Electron v1.3.4 (this version using API 49, more info )

oh my god @dvanoni I can fix it finally first add this to package.json step 1: add build configuration for electron

 "build": {
    "buildDependenciesFromSource": "true",
    "npmRebuild": "false"
  },

step 2: then run npm i electron-builder electron-rebuild electron@4.2.7 -D

step 3: run .\node_modules\.bin\electron-rebuild.cmd -f or .\node_modules\.bin\electron-rebuild.cmd -f -o node-sass

step 4: Copy the generated binding.node file to the necessary directory (as @dvanoni and @hdytsgt metion): copy: node-sass\bin\win32-x64-69\node-sass.node to {{target node-sass folder}}\node-sass\vendor\win32-x64-69\node-sass.node and copy: node-sass\build\Release\binding.node to {{target node-sass folder}}\node-sass\vendor\win32-x64-69\

that all thank all of you, have a nice day

@hiepxanh it’s been a while now since I’ve done it, but these are the steps I had written down for myself.

Rebuild node-sass explicitly using electron-rebuild:

.\node_modules\.bin\electron-rebuild -o node-sass

Copy the generated binding.node file to the necessary directory:

copy .\node_modules\node-sass\build\Release\binding.node .\node_modules\node-sass\vendor\win32-x64-57\

Note that this depends on the version of Electron you’re using as mentioned above. i.e. you would need to replace the win32-x64-57 part to match your version. I also had a note for myself that this directory may need to be manually created if it doesn’t exist.