For some reason, on both Windows 8.1 and Windows 10 I've encountered the following issue:
Failed to compile D:/Projects/nepenthe-on-node/app/styles/main.sass: A dynamic link library (DLL) initialization routine failed.
d:Projectsnepenthe-on-nodenode_moduleselectron-compilenode_moduleselectron-compilersnode_modulesnode-sassvendorwin32-x64-44binding.node
Error: A dynamic link library (DLL) initialization routine failed.
d:Projectsnepenthe-on-nodenode_moduleselectron-compilenode_moduleselectron-compilersnode_modulesnode-sassvendorwin32-x64-44binding.node
at Error (native)
at Object.module.(anonymous function) (ATOM_SHELL_ASAR.js:137:20)
at Object.module.(anonymous function) as .node
at Module.load (module.js:351:32)
at Function.Module._load (module.js:306:12)
at Module.require (module.js:361:17)
at require (module.js:380:17)
at Object.
at Module._compile (module.js:426:26)
at BabelCompiler.loadFile (d:Projectsnepenthe-on-nodenode_moduleselectron-compilenode_moduleselectron-compile-cachelibcompile-cache.js:199:23)
at Object.value as .js
at Module.load (module.js:351:32)
at Function.Module._load (module.js:306:12)
at Module.require (module.js:361:17)
at require (module.js:380:17)
at ScssCompiler.initializeCompiler (d:Projectsnepenthe-on-nodenode_moduleselectron-compilenode_moduleselectron-compilerslibcssscss.js:91:14)
at ScssCompiler.loadFile (d:Projectsnepenthe-on-nodenode_moduleselectron-compilenode_moduleselectron-compile-cachelibcompile-cache.js:206:49)
at Function.
P.S. This happens regardless of which type of node I use (nodejs v0.12.7, iojs v2.5.0)
The messages above indicate you are using Atom Shell which is not supported by our binary bindings.
@saper If you make your binary bindings fall back to compiling from source, this should Just Workâ„¢ when electron-rebuild runs over the package - afaik node-pre-gyp is supposed to do this but doesn't seem to do so
That's what we normally do (npm install node-sass falls back to building from source).
For a successful source build you need a working compiler, pieces of Windows SDK (can be taken from mingw packages), and node development headers (the last one is usually taken care of by pangyp).
Hm, maybe we're matching against an io.js binary shipped with node-sass that isn't actually compatible with Electron on Windows? NODE_MODULE_VERSION for Electron 0.30.x is 44.
Electron a.k.a. Atom Shell is not compatible with our modules.
k. So how do we fix that?
You can compile it from source.
k.
Just fetch node-sass from git and use path/to/node scripts/install.js -f in the node-sass directory. Use the node engine you intend to use (i.e. that one from electron). It might fail if pangyp cannot fetch development headers for your engine. In that case try to use --nodedir flag to point pangyp to a directory with the engine source.
Just fetch node-sass from git and use path/to/node scripts/install.js -f in the node-sass directory. Use the node engine you intend to use (i.e. that one from electron).
Aha! Now -f is something I can use. Thanks for the tip, I'll see what I can do (will probably build this into https://github.com/electronjs/electron-compile so it Just Worksâ„¢)
It will be seamless only if you bundle mingw with it...
Closing this, as atom-shell is currently not supported.
@paulcbetts: Did you book any progress with this? My goal is to make a simple electron app on which you can drag a folder. The app will watch the files and compile sass -> css on change.
electron-compile or electron-rebuild should make this possible right?
Even if the node-gyp process can't run on that computer? (cause they might not have python or msbuild.exe, installed)
Thanks in advance
Nope, I kinda gave up on it tbh. People should just use something else for Electron until node-sass works
We have no plans to support atom shell. We are however open to pull requests that improve the situation for those users.
Thank you guys for the reply. I will have a look and see or I can contribute cause I would really like to bring node-sass to Electron.
I must admit I would not really know where to start so I would appreciate advice. To me it seems the first step could be to setup some kind of process that could compile the binaries and make them available for those in need :).
I found a list of binaries here. I tried to compile inside of electron but not with any success. How could I compile (npm rebuild node-sass) from within electron?
I found this issue which gives some more background to this issue.
@paulcbetts Could you share how far you got with it? Maybe link to a PR or to some other issues?
Any resources or articles on this would be welcome.
And this guide is not an answer to this in any way?
https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md
Yes, this guide is a good way to start. You can also use --nodedir option to point node-gyp to the correct electron header files.
@saper Thanks! Much appreciate any advice. Do you have some resource explaining more about how header files work?
Did you guys setup some kind of automated process to collect these binaries in the following repo?
https://github.com/sass/node-sass-binaries
If so: Do you have a script for that?
I could imagine writing some bash script which would;
1) spins up a virtualbox
2) connects via ssh,
3) installs the right version of node and node-sass,
4) builds and saves the binary
in case of Windows we are using @appveyor to generate binaries and PDB files, they are automatically atrached to the release on github. node-sass-binaries are half-manual.
You can check appveyor.yml for the PowerShell magic to do that. We currently differentiate Node APIs by the platform (win32), processor bus width and the internal Node API number (a number ranging from 11 to 47 currently).
There is a code in the scripts/install.js to detect the platform.
I don't know what are the exact differences w/atom - I think it uses an older Node API that is still supported by us, so that should not be a problem. Maybe it is just the matter of attaching a different binary name in the DLL hook.
Thank you for the pointers. I will have to do some reading first :)
I have tried all the options from the guide on the electron website only discovering other blocking issues.
@saper: where and how can I edit the DLL hook? The current version of Electron (0.36.10) uses Node 5.1.1
ps: I don't know or I mentioned this before but on linux after apt-get install g++ rebuild-tools I have it working. That still uses the node-gyp build right? If so; could that mean that the problem is with the build tools used under the hood of node-gyp?
You guys did a great job with the automated creation of binaries by the way :). A whole new world for me.
Got it working with a slight variation to the rebuild instructions as suggested by this answer.
@saper: This does not seem hard at all. Maybe this can be added to the automated builds you guys already run on AppVeyor. What do you think?
@stefanKuijers great work. You're completely welcome to create a PR adding this to our AppVeyor.
@xzyfer I am happy to contribute but I might need a little guidance into which files I should look at and even which repo :D.
I think my first step is to just add the compiled binaries to your binary-repo. I opened an issue there cause I am not sure about the naming of the binaries as they should have the same name but are build with electron headers. see: https://github.com/sass/node-sass-binaries/issues/123
To be honost I don't even know or ones build with electron headers are working outside of electron as well. That will be interesting to find out :thought_balloon:
Unfortunately it's too early for your node-sass-binaries PR. The first will
be getting auto builds into our CI process. Once we gain confidence that we
can support electron we'll automate building binaries for releases.
The next step would be documenting step by step what's required to build
the binaries.
On 27 Mar 2016 1:38 AM, "S Kuijers" [email protected] wrote:
@xzyfer https://github.com/xzyfer I am happy to contribute but I _might
need a little guidance into which files_ I should look at and even which
repo :D.I think my first step is to just add the compiled binaries to your
binary-repo. I opened an issue there cause I am not sure about the naming
of the binaries as they should have the same name but are build with
electron headers. see: sass/node-sass-binaries#123
https://github.com/sass/node-sass-binaries/issues/123To be honost I don't even know or ones build with electron headers are
working outside of electron as well. That will be interesting to find out [image:
:thought_balloon:]—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/sass/node-sass/issues/1047#issuecomment-201834804
Steps to create binary:
0) Meet prerequisites for building with node-gyp
1) Obtain required versions - I did not find a list with which versions of electron use which version of node but I know 0.36.10 use node 5.1.1. Found it out by following the quickstart guide which takes 2 minutes.
2) Switch node version - Installed nvm and switched to the same version as electron is using. So in this case: 5.1.1.
3) Stage for rebuilding - all steps except build from your instructions
git clone --recursive https://github.com/sass/node-sass.git
cd node-sass
git submodule update --init --recursive
npm install
4) Add build arguments. This step was suggested by theAppleFreak scripts/build.js:133
Arguments (target is the version of electron that we use - 0.36.10):
'--target=0.36.10', '--arch=x64', '--dist-url=https://atom.io/download/atom-shell'
Line 133 will look like this:
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose', '--target=0.36.10', '--arch=x64', '--dist-url=https://atom.io/download/atom-shell'].concat(
5) Build - Last step from your instructions
node scripts/build -f
Is this clear enough?
@stefanKuijers this is pretty good. For step 4) we need to have the ability to detect we are running under electron. We also need some identifier in the binary file to distinguish between electron and node binaries.
@saper: I am not really sure in what language or context we need to detect this but would it help to just check the package.json or electron is a dependency? I would not see any other usecase for including electron unless you want to build an app with it. What I am sure of is that there is someone who will have some great ideas on this and that would be @paulcbetts. He build the electron-rebuild thing so I imagine he has some more insight into this.
What about the identifier? Would this mean that there would be 1 binary for with or without electron? or more of a way that node-sass would know which one of the two binaries to pick when it needs to run.
@stefanKuijers ‘s way worked, think you very much.
@stefanKuijers you have nailed it in the last sentence. We need to figure out if we are running under electron or not, and then we need to pick up a proper binary. Node configuration information is usually stored in the process object.
type in process will tell you if you're under Electron
Because of this, I have prebuilt node-sass for Electron, here: https://github.com/littledu/node-sass-prebuild-for-electron
We would love more information on how you did this so we could officially
support it
On 2 Jul 2016 7:59 PM, "littledu" [email protected] wrote:
Because of this, I have prebuilt node-sass for Electron, here:
https://github.com/littledu/node-sass-prebuild-for-electron—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/1047#issuecomment-230093976,
or mute the thread
https://github.com/notifications/unsubscribe/AAjZWF-Etc2EEHoDZAWY1pRtMqyhKSxrks5qRjaagaJpZM4FjUkO
.
hi, @xzyfer ,I follow @stefanKuijers steps to solve this problem, but I do not know why. I can not be re compiled every time, so I use appveyor to automatically compile
I took a little break in my hobby project but would like to get back to it soon. For this I would certainly need crossplatform electron/node-sass. I think amazing apps can be build with this.
@littledu I understand how appveyor could play a role in a better solution but would be _really_ interested in _how_ you've solved it with appveyor. Could you post some instructions here about to which files you've added what?
@xzyfer, @saper Where are you guys standing in supporting electron? What info, examples, PRs would you guys like to get this going?
Most helpful comment
Steps to create binary:
0) Meet prerequisites for building with node-gyp
1) Obtain required versions - I did not find a list with which versions of electron use which version of node but I know 0.36.10 use node 5.1.1. Found it out by following the quickstart guide which takes 2 minutes.
2) Switch node version - Installed nvm and switched to the same version as electron is using. So in this case: 5.1.1.
3) Stage for rebuilding - all steps except build from your instructions
4) Add build arguments. This step was suggested by theAppleFreak
scripts/build.js:133Arguments (target is the version of electron that we use - 0.36.10):
Line 133 will look like this:
5) Build - Last step from your instructions
Is this clear enough?