-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix webpacker:check_node to display version error #798
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently, if you have an older version of node installed that is referenced by `nodejs` instead of `node`, this code receives an Errno::ENOENT exception from the `node -v` command, bypassing the `node_version.blank?` check and telling the user Node is not installed. Instead, we should catch that exception and check for `nodejs -v` and let them know they need to upgrade versions.
curvo
approved these changes
Sep 14, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me. There are number of other issues with this rake task on older systems though but I think they should be addressed in a different PR.
cc @gauravtiwari, should merge this? |
brasic
added a commit
to brasic/webpacker
that referenced
this pull request
Dec 14, 2017
Running this task when rails is loaded doesn't behave as expected because ActiveSupport monkeypatches Kernel#` as follows: https://github.com/rails/rails/blob/7d75599c875b081f63fc292e454b25e8e42eb60e/activesupport/lib/active_support/core_ext/kernel/agnostics.rb to suppress raising Errno::ENOENT. With this monkeypatch in place the code never reaches the fallback branch for legacy node versions introduced in rails#798 We can fix this by manually raising the exception that the activesupport monkeypatch has suppressed.
gauravtiwari
pushed a commit
that referenced
this pull request
Dec 15, 2017
* Raise ENOENT like vanilla ruby Running this task when rails is loaded doesn't behave as expected because ActiveSupport monkeypatches Kernel#` as follows: https://github.com/rails/rails/blob/7d75599c875b081f63fc292e454b25e8e42eb60e/activesupport/lib/active_support/core_ext/kernel/agnostics.rb to suppress raising Errno::ENOENT. With this monkeypatch in place the code never reaches the fallback branch for legacy node versions introduced in #798 We can fix this by manually raising the exception that the activesupport monkeypatch has suppressed. * Simplify nested rescues Using shell syntax to choose either node or nodejs has the extra benefit of never raising Errno::ENOENT whether or not Kernel#` has been monkeypatched by ActiveSupport.
KingTiger001
added a commit
to KingTiger001/Rails-web-pack-project
that referenced
this pull request
Jan 15, 2023
* Raise ENOENT like vanilla ruby Running this task when rails is loaded doesn't behave as expected because ActiveSupport monkeypatches Kernel#` as follows: https://github.com/rails/rails/blob/7d75599c875b081f63fc292e454b25e8e42eb60e/activesupport/lib/active_support/core_ext/kernel/agnostics.rb to suppress raising Errno::ENOENT. With this monkeypatch in place the code never reaches the fallback branch for legacy node versions introduced in rails/webpacker#798 We can fix this by manually raising the exception that the activesupport monkeypatch has suppressed. * Simplify nested rescues Using shell syntax to choose either node or nodejs has the extra benefit of never raising Errno::ENOENT whether or not Kernel#` has been monkeypatched by ActiveSupport.
smartech7
pushed a commit
to smartech7/ruby-webpacker
that referenced
this pull request
Aug 4, 2023
* Raise ENOENT like vanilla ruby Running this task when rails is loaded doesn't behave as expected because ActiveSupport monkeypatches Kernel#` as follows: https://github.com/rails/rails/blob/7d75599c875b081f63fc292e454b25e8e42eb60e/activesupport/lib/active_support/core_ext/kernel/agnostics.rb to suppress raising Errno::ENOENT. With this monkeypatch in place the code never reaches the fallback branch for legacy node versions introduced in rails/webpacker#798 We can fix this by manually raising the exception that the activesupport monkeypatch has suppressed. * Simplify nested rescues Using shell syntax to choose either node or nodejs has the extra benefit of never raising Errno::ENOENT whether or not Kernel#` has been monkeypatched by ActiveSupport.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, if you have an older version of node installed that is referenced by
nodejs
instead ofnode
, this code receives an Errno::ENOENT exception from thenode -v
command, bypassing thenode_version.blank?
check and telling the user Node is not installed. Instead, we should catch that exception and check fornodejs -v
and let them know they need to upgrade versions.