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

TypeError: Cannot read property 'version' of undefined #4055

Closed
Ruk33 opened this issue May 11, 2021 · 17 comments · Fixed by #4077
Closed

TypeError: Cannot read property 'version' of undefined #4055

Ruk33 opened this issue May 11, 2021 · 17 comments · Fixed by #4077

Comments

@Ruk33
Copy link

Ruk33 commented May 11, 2021

Unable to complete installation steps.

Solidus Version:

3.0.1

To Reproduce

  1. Follow installation steps
  2. Start rails server
  3. Go to localhost:3000

Current behavior

The following error can be seen on the page

Showing /usr/local/bundle/gems/solidus_frontend-3.0.1/app/views/spree/shared/_head.html.erb where line #7 raised:

TypeError: Cannot read property 'version' of undefined
Trace of template inclusion: /usr/local/bundle/gems/solidus_frontend-3.0.1views/spree/layouts/spree_application.html.erb

Rails.root: /app

Expected behavior

The app works properly

Screenshots

image

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows using WSL and Docker
  • Browser [e.g. chrome, safari] Brave
  • Version [e.g. 22] V1.24.82

Additional context

  • Tried my own custom docker version
  • Tried using plain ruby and rails
  • Tried with rails 5 and 6
  • Tried using the docker version from master

In all scenarios, I get the same error.

@jlacaciom
Copy link

I have the same problem :(, i try in two different macbook and nothing. :(

@Ruk33
Copy link
Author

Ruk33 commented May 11, 2021

As an additional note, if the line https://github.com/solidusio/solidus/blob/master/frontend/app/views/spree/shared/_head.html.erb#L8 gets commented out, the page loads correctly (without styles but at least it works)

@jlacaciom
Copy link

Any solution? 😞

@jarednorman
Copy link
Member

Do you have NodeJS installed? What version?

execjs is the gem that Rails/Sprockets relies on to execute JavaScript, so something is going wrong on the asset pipeline side of things, it seems.

@Ruk33
Copy link
Author

Ruk33 commented May 11, 2021

Hello @jarednorman , yes I do

➜  ~ node -v
v15.4.0
➜  ~ npm -v
7.0.15

As a note, I also tried the dockerfile you guys have on the project and that didn't worked either (I used the sandbox application)

@jlacaciom
Copy link

Yes i have v14.16.1 and other mac v14.15.4 but still the error persist.

@jarednorman
Copy link
Member

Hmm, that's definitely strange that we'd be getting an error in execjs then. Is it possible for you to provide the full framework trace?

@benjaminwil
Copy link
Contributor

Hello, I saw this same error yesterday.

It seems to be an incompatibility with the new version of execjs and Ruby < 2.7.

See rails/execjs#99.

For me, the short-term solution is to lock to an older version of execjs

@jarednorman
Copy link
Member

Thanks @benjaminwil. I'm going to close this as I don't think there's any action for us to take within Solidus itself, but this thread should be useful for other people encountering the issue.

@jarednorman
Copy link
Member

jarednorman commented May 11, 2021

Either upgrade Ruby or downgrade execjs if you hit this issue. rails/execjs#99 (comment)

See: #4055 (comment)

@Ruk33
Copy link
Author

Ruk33 commented May 11, 2021

Ok, tried again with:

  • Ruby 3.0.1
  • Rails 6.1.3.2
  • Solidus 3.0.1

Did no extra step and not it's working just fine:

image

@jarednorman
Copy link
Member

Sounds like it's actually an autoprefixer-rails issue: ai/autoprefixer-rails#203

@kennyadsl
Copy link
Member

I'd keep this open until we have a solution to give it more visibility to the community.

@dominicsanto
Copy link

dominicsanto commented May 14, 2021

Still experiencing this issue with the following :

Ruby 3.0.1
Rails 6.1.3.2
Solidus 3.0.1

ExecJS is sitting on 2.8.1

@kennyadsl
Copy link
Member

@dominicsanto we are not seeing the issue anymore in our specs. Can you share your Gemfile.lock in a gist please?

@dominicsanto
Copy link

@kennyadsl I had to upgrade my version of autoprefixer-rails to use 10.2.5.0. Now the store is loading correctly

@waiting-for-dev
Copy link
Contributor

I had to upgrade my version of autoprefixer-rails to use 10.2.5.0. Now the store is loading correctly

However, keep in mind it's not compatible with Ruby 3.0, although Solidus is not 100% compatible either yet. A definitive fix from autoprefixer-rails side should be available soon.

benjaminwil added a commit to SuperGoodSoft/solidus_related_products that referenced this issue May 21, 2021
At lesser versions, the test suite encounters an error and cannot run:

    Failure/Error: Unable to find eval (eval at <anonymous> ((execjs) to
      read failed line

    ExecJS::ProgramError:
      TypeError: Cannot read property 'version' of undefined
      # eval (eval at <anonymous> ((execjs):1:213), <anonymous>:1:10)
      # (execjs):1:213
      # (execjs):19:14
      # ...

This seems related to the issue reported on Solidus:
solidusio/solidus#4055. Adding `autoprefixer-rails` at the latest
version side-steps the issue.
waiting-for-dev added a commit to nebulab/solidus that referenced this issue May 24, 2021
rmparr pushed a commit to rmparr/solidus that referenced this issue Jun 1, 2022
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

Successfully merging a pull request may close this issue.

7 participants