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

Node-sass is not working due to node version difference #1387

Closed
dz902 opened this issue Feb 28, 2018 · 16 comments
Closed

Node-sass is not working due to node version difference #1387

dz902 opened this issue Feb 28, 2018 · 16 comments
Milestone

Comments

@dz902
Copy link

dz902 commented Feb 28, 2018

  • Operating System: OSX
  • Cypress Version: 2.0.4
  • Browser Version: doesn't matter

Is this a Feature or Bug?

Bug / Question

Current behavior:

  • Using cypress against webpack.
  • At 1.4, node-sass throw: Node Sass could not find a binding for your current environment: OS X 64-bit with Electron.
  • Then I updated to 2.0.4, node-sass throw again: Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 8.xX
  • This also follows the error: Found bindings for the following environments: OS X 64-bit with Node.js 9.x
  • The project itself can compile successfully, I'm using webpack-dev-server which is working okay

Desired behavior:

  • I understand that this is because cypress runs its own environment, at first Electron, then a different version of node
  • I am not sure how to make those versions match, or whether it's possible to upgrade node version of cypress
  • It should work and behave the same for the project and tests, I believe

Advices are welcome. Thanks!

@brian-mann
Copy link
Member

Are you running Cypress from source? Or using the npm package?

Do you mind providing a reproducible repo? A good majority of our users use webpack without a problem.

@dz902
Copy link
Author

dz902 commented Feb 28, 2018

I'm running from the npm package.

I think the problem is with node-sass and node version, webpack is fine. I'll see if I can make a minimal repo to reproduce it.

@bahmutov
Copy link
Contributor

bahmutov commented Feb 28, 2018 via email

@dz902
Copy link
Author

dz902 commented Feb 28, 2018

https://github.com/dz902/cypress-test-tiny

Here we go, a demo. Is it possible to use native node instead of bundled node? As I really only need webpack to compile, and cypress should only be responsible for running the compiled test (maybe this is only for my web-development scenario).

Any ideas on whether it's possible?

@dz902
Copy link
Author

dz902 commented Feb 28, 2018

@bahmutov

Oh man I did not know there is a package for vue. I'm using vue. Really love to test vue with cypress, both great.

Is this problem solvable?

@dz902
Copy link
Author

dz902 commented Feb 28, 2018

Said issue cypress-io/cypress-vue-unit-test#18

@brian-mann
Copy link
Member

We likely need to rebuild the native node-sass prior to distributing Cypress - as it comes prepacked with native binaries.

@dz902
Copy link
Author

dz902 commented Feb 28, 2018

Is there anything I can do at the time to alleviate the problem? Or maybe there is a hidden option to use native node instead of bundled node?

@bahmutov
Copy link
Contributor

Someone suggested in cypress-io/cypress-vue-unit-test#18 (comment) that using Node 8 to install and run Cypress solves the problem

@dz902
Copy link
Author

dz902 commented Feb 28, 2018

Cool, downgrading to 8 and reinstalling node-sass solved the problem.

For any searchers landed here: I just found that there is a list of pre-compiled binaries, which user could download (number 57_binding is for Node 8) and should be able to make cypress work. A map of number -> platform can be found in extension.js in node-sass directory for downloading the correct binary.

This breaks the integrity of the package though, as this has to be done manually by user.

Ultimately there will be a hero to create a real node/js based compiler for sass (or replace it altogether), distributing binaries is just ridiculous for a CSS-transpiler.

@dz902 dz902 closed this as completed Feb 28, 2018
@brian-mann
Copy link
Member

brian-mann commented Feb 28, 2018

I think I know what the problem is - we build OSX + Windows version of Cypress in each applicable operating system.

In those builds - we forgot the bump the locally installed node version. So what's happening is that Cypress is using node 6.x.x to install and build native node modules (node-sass) and then it's build the Cypress binary and then uploading it with those node modules.

Linux is correct - because we did bump the node version there.

As long as we bump Windows + OSX node version when distributing Cypress binaries everything "will just work".

We'll need to release 2.0.5 with this fix. As long as Cypress itself distributes the binaries natively compiled against its node version everything will always work. So it's actually a benefit to distributing node as opposed to using system node.

When we originally released version 2.0.0 we bumped Electron which also bumped node to 8.x.x and this is where the problem was introduced.

@brian-mann
Copy link
Member

Fixed by #1390

@brian-mann brian-mann added this to the 2.1.0 milestone Mar 1, 2018
@brian-mann
Copy link
Member

Released in 2.1.0.

@pedroteixeira
Copy link

Hello, is there any way to run Cypress on node v9.x?
it seems there isn't, just want to confirm :)

@brian-mann
Copy link
Member

Cypress comes bundled with its own node version and there is no way to change that.

@mAAdhaTTah
Copy link

Is there any way to run the install process with Cypress's built-in node version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants