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

Autoprefixer version detection broken with latest execjs #160

Closed
aleksclark opened this issue Jul 3, 2019 · 13 comments
Closed

Autoprefixer version detection broken with latest execjs #160

aleksclark opened this issue Jul 3, 2019 · 13 comments

Comments

@aleksclark
Copy link

With the following versions:

autoprefixer-rails (9.6.0)
GIT
  remote: https://github.com/rails/execjs.git
  revision: f6dc08c58ab4e1a467f64d471ee6e0127c2f14de
  ref: f6dc08c
  specs:
    execjs (2.7.0)

Autoprefixer seems to be using an invalid way of detecting node versions:

        if ExecJS.runtime == ExecJS::Runtimes::Node
          version = ExecJS.runtime.eval("process.version")
          first = version.match(/^v(\d+)/)[1].to_i
          if first < 6
            raise "Autoprefixer doesn’t support Node #{version}. Update it."
          end
        end

This code throws a TypeError, because process is null. If I comment out the check, autoprefixer seems to be functioning correctly.

@ai
Copy link
Owner

ai commented Jul 3, 2019

What ExecJS runtime so you use?

@aleksclark
Copy link
Author

Node, the vanilla one.

@ai
Copy link
Owner

ai commented Jul 3, 2019

What Node.js version?

@aleksclark
Copy link
Author

Oh sorry, v10.16.0. I think it also happens for node 8, but as part of my troubleshooting I've standardized on node 10 and it's tough to go back and test.

@ai
Copy link
Owner

ai commented Jul 3, 2019

Hm. process is not null on Node.js 10. Maybe ExecJS uses different engine because of some issue?

@aleksclark
Copy link
Author

aleksclark commented Jul 3, 2019 via email

@ai
Copy link
Owner

ai commented Jul 3, 2019

User can pass custom node path to ExecJS

@ai
Copy link
Owner

ai commented Jul 3, 2019

We have a different question here. process should be always available on Node since it is part of Node’s stdlib.

@aleksclark
Copy link
Author

I completely agree! I've created a minimal test case, can you try it? https://github.com/aleksclark/autoprefixer-bug-repro

@aleksclark
Copy link
Author

Also, here's the version that does work:
https://github.com/aleksclark/autoprefixer-bug-repro/tree/working

As you can see, the difference is in using the latest version of execjs. The problem is that the latest release of execjs is quite old, and does not prefer node over nodejs

@ai
Copy link
Owner

ai commented Jul 3, 2019

Do we need to fix the problem if it is related with old ExecJS and could be a bug, which they fixed?

@aleksclark
Copy link
Author

aleksclark commented Jul 3, 2019 via email

@ai
Copy link
Owner

ai commented Jul 3, 2019

I afraid that without stdlib I can garantee that other autoprefixer.js will work. It should have process calls in polyfills.

I am closing this issue, since I have no idea how to fix it.

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

2 participants