Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building node-sass for Electron v1.6.11 #2054

Closed
aleclarson opened this Issue Jul 26, 2017 · 18 comments

Comments

Projects
None yet
7 participants
@aleclarson
Copy link

aleclarson commented Jul 26, 2017

I tried doing npm run-script build, but that builds the binary for darwin-x64-51 when I need darwin-x64-53 for Electron.

I also tried:

node scripts/build.js --target 1.6.11 --target_arch x64 --dist-url https://atom.io/download/electron --sass-binary-path $PWD/vendor/darwin-x64-53

..which failed with:

/Users/aleclarson/modules/node-sass/vendor/darwin-x64-53 not found

Any pointers would be appreciated!

Versions

  • node-sass version: 4.5.3
  • Electron version: 1.6.11
  • Node version: 7.4.0
  • Node modules version: 53
  • Node platform: darwin
@aleclarson

This comment has been minimized.

Copy link
Author

aleclarson commented Jul 26, 2017

Perhaps I should be following this guide. I'll try a few things, but any help would be awesome.

@aleclarson

This comment has been minimized.

Copy link
Author

aleclarson commented Jul 26, 2017

The first thing I tried:

node-gyp rebuild --target=1.6.11 --arch=x64 --dist-url=https://atom.io/download/electron

No errors, but no vendor/darwin-x64-53 directory was created.

@aleclarson

This comment has been minimized.

Copy link
Author

aleclarson commented Jul 26, 2017

Then I tried require('./scripts/build') from inside Electron dev tools, but an error was thrown.

Build failed with error code: 1

The build process was spawned with:

/Users/aleclarson/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS/Electron Helper /Users/aleclarson/modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
@aleclarson

This comment has been minimized.

Copy link
Author

aleclarson commented Jul 26, 2017

Mission accomplished. 🚀

# Build for Electron v1.6.11
ARCH="x64"
node-gyp rebuild --target=1.6.11 --arch=$ARCH --dist-url=https://atom.io/download/electron

# Create vendor directory
VENDOR="vendor/darwin-$ARCH-53"
mkdir $VENDOR
cp build/Release/binding.node $VENDOR

# Clean up
rm -rf build

edit: I whipped up a script you may find useful: https://gist.github.com/aleclarson/71ddec23c9e9ca3679f75c17addb1a44

@aleclarson aleclarson closed this Jul 26, 2017

@xp6530

This comment has been minimized.

Copy link

xp6530 commented Aug 2, 2017

It seems that this method does not work~ @aleclarson

@aleclarson

This comment has been minimized.

Copy link
Author

aleclarson commented Aug 2, 2017

@xp6530 I can help if you provide your OS version, Electron version, node-gyp version, which method you tried, and what error (if any) was logged. 👍

@cdswyda

This comment has been minimized.

Copy link

cdswyda commented Aug 9, 2017

@aleclarson
I also want an runtime (53) file for my proiect on widows .
How do I rebuild it?

ARCH="x64"
node-gyp rebuild --target=1.6.11 --arch=$ARCH --dist-url=https://atom.io/download/electron

When I run the ablove code in CMD, it reminde me : ARCH: unknown option -- target=1.6.11

node : 6.11.0
node-gyp: 3.6.2
electron: 1.6.11
electron-rebuild:1.6.0

@aleclarson

This comment has been minimized.

Copy link
Author

aleclarson commented Aug 9, 2017

@cdswyda I'm not familiar with the command line nuances of Windows, but I know for sure that --target is a valid option (see here). Maybe you need to wrap it in quotes? ¯\_(ツ)_/¯

@gimenete

This comment has been minimized.

Copy link

gimenete commented Sep 1, 2017

@aleclarson Thanks, it worked for me for macOS and electron 1.6.12. I've improved the script a bit to automate it:

#!/bin/bash

set -e
ARCH="x64"
TARGET=$(node -e "console.log(require('./package.json').devDependencies.electron.match(/\d+\.\d+.\d+/)[0])")
PLATFORM=$(node -e "console.log(process.platform)")

cd node_modules/node-sass/

# Build for Electron for current version
node-gyp rebuild --target=$TARGET --arch=$ARCH --dist-url=https://atom.io/download/electron

# Create vendor directory
VENDOR="vendor/$PLATFORM-$ARCH-53"
mkdir -p $VENDOR
cp build/Release/binding.node $VENDOR

cd ../../

# Clean up
rm -rf build
@pro-w-xuan

This comment has been minimized.

Copy link

pro-w-xuan commented Sep 7, 2017

@cdswyda in your windows, It work? Can you help me? Thank you very much. I recompiled node-sass but I made a mistake:

Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (50)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.5.3
at module.exports (J:\project\BrickFlow\node_modules\node-sass\lib\binding.js:13:13)
at Object. (J:\project\BrickFlow\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object. (J:\project\BrickFlow\node_modules\gulp-sass\index.js:187:21)

my system is windows 10.
gyp info using node-gyp@3.6.2
gyp info using node@8.3.0 | win32 | x64
electron: 1.7.6

@cdswyda

This comment has been minimized.

Copy link

cdswyda commented Sep 8, 2017

@pro-w-xuan I'm sorry. It doesn't work on my windows computer. I use stylus instead of sass,only need to use '=' replace ':' in sass file.
but some specific syntax can't use in stylus.

@pro-w-xuan

This comment has been minimized.

Copy link

pro-w-xuan commented Sep 14, 2017

@cdswyda Thank you for your reply, I haven't solve this

@cdswyda

This comment has been minimized.

Copy link

cdswyda commented Dec 11, 2017

@gimenete Thank you very much, I use your script build this successfully.

@cdswyda

This comment has been minimized.

Copy link

cdswyda commented Dec 11, 2017

@pro-w-xuan Have you solved this problem ? with gimenete's script ,it works well.

#!/bin/bash

set -e
ARCH="x64"
TARGET=$(node -e "console.log(require('./package.json').devDependencies.electron.match(/\d+\.\d+.\d+/)[0])")
PLATFORM=$(node -e "console.log(process.platform)")

cd node_modules/node-sass/

# Build for Electron for current version
node-gyp rebuild --target=$TARGET --arch=$ARCH --dist-url=https://atom.io/download/electron

# Create vendor directory
VENDOR="vendor/$PLATFORM-$ARCH-54"
mkdir -p $VENDOR
cp build/Release/binding.node $VENDOR

cd ../../

# Clean up
rm -rf build

Make above content in a .sh file, then run it in Git Bash.

@gimenete

This comment has been minimized.

Copy link

gimenete commented Dec 18, 2017

@pro-w-xuan @cdswyda the error is telling you the API version you need to use when compiling:

Error: Node Sass does not yet support your current environment:
    Windows 64-bit with Unsupported runtime (50)

In this case it's 50. Use that in the VENDOR declaration:

VENDOR="vendor/$PLATFORM-$ARCH-50"

Now that I'm using electron 1.7.x for me it's 54.

@alex-i-n

This comment has been minimized.

Copy link

alex-i-n commented Oct 25, 2018

Thanks for the script @gimenete, I was able to get node-sass working with electron 3.0.6 (using runtime 64). I've been stuck on this for a while now, it's good to finally get it working.

The error I was getting is:

dyld: lazy symbol binding failed: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
  Referenced from: /node_modules/node-sass/vendor/darwin-x64-64/binding.node
  Expected in: flat namespace
@georgschlenkhoff

This comment has been minimized.

Copy link

georgschlenkhoff commented Nov 21, 2018

@alex-i-n I have the same issue with node-sass you described. What were the exact steps you followed? Did you build node-sass for your platform?

@alex-i-n

This comment has been minimized.

Copy link

alex-i-n commented Mar 22, 2019

@georgschlenkhoff I used the script provided by @gimenete and replaced VENDOR="vendor/$PLATFORM-$ARCH-53" with VENDOR="vendor/$PLATFORM-$ARCH-64".

Sorry for being so late to respond, didn't notice the GH notification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.