nuxt-community / electron-template

Electron starter with nuxt.js
MIT License
251 stars 31 forks source link

sass-loader doesn't work #5

Closed foundryspatial-duncan closed 7 years ago

foundryspatial-duncan commented 7 years ago

I'm getting a fatal error when I try to use <style lang="scss">. On OSX El Capitan 10.11.6, if I install the sass-loader with:

yarn add --dev sass-loader node-sass

...and then try to do yarn run dev, I get the following error:

Module build failed: Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (53)

I'm confused about this error, because scss works just fine with other vue+electron projects like SimulatedGREG/electron-vue. I don't understand why the sass-loader or node-sass would be trying to un under a different environment, regardless of if electron is used. Any idea?

This question is available on Nuxt.js community (#c7)
detrohutt commented 7 years ago

Although the OS is different I believe the error you're experiencing is related to this node-sass issue.

Basically, they don't support Electron.. I'm not familiar with the project you mentioned so I'm not sure how they're getting it to work. If I get some time I'll try to figure it out.

In the meantime, the last comment in the issue I linked to has a solution that may work for you(don't forget to change the Electron version as he suggests).

If you try it, let me know if that solves the issue for you.

foundryspatial-duncan commented 7 years ago

Is there a way to get all of the build steps to still happen locally, as with regular nuxt? I expected vue-loader and everything to be running locally, and merely serving the built files to electron, just as if it were a browser pointed at the dev server. Is that not the case?

detrohutt commented 7 years ago

@Atinux could probably answer that question better than I can

foundryspatial-duncan commented 7 years ago

Thanks, I'm confused about how and where node-sass is trying to run, because sass works just fine with the SimulatedGREG/electron-vue project, for example.

benplain commented 7 years ago

In case it helps, I am using SimulatedGREG/electron-vue and do not have issues compiling the sass in my electron app. However, I am running an express server in the same project (similar webpack config) using webpack-dev-middleware and webpack-hot-middleware and I get the same error:

Module build failed: Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (53)

atinux commented 7 years ago

Actually it's not the case @foundryspatial-duncan

As you can see in the dev script, it's electron which run the JS script, which is another runtime and node-sass does not support it at the moment.

But actually, it works if you do npm run build && npm run start.

It seems that it's only when using node-sass on the "server" ran by Electron (that's why the other electron-vue boilerplate works since they don't use any server).

This seems to be the only solution to supports node-sass on development mode: https://github.com/sass/node-sass/issues/1682#issuecomment-248254180