faye / websocket-driver-ruby

WebSocket protocol handler with pluggable I/O
Other
223 stars 43 forks source link

Install gem on WSL2 (Ubuntu 20.04) fails with error: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. #86

Open andyBobro opened 3 years ago

andyBobro commented 3 years ago

I installed gems to project and it failed with message:

Fetching websocket-driver 0.7.5
Installing websocket-driver 0.7.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/brobobro/.rvm/gems/ruby-2.7.2/gems/websocket-driver-0.7.5/ext/websocket-driver
/home/brobobro/.rvm/rubies/ruby-2.7.2/bin/ruby -I
/home/brobobro/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0 -r ./siteconf20210929-2314-1hf0sbp.rb
extconf.rb
creating Makefile

current directory:
/home/brobobro/.rvm/gems/ruby-2.7.2/gems/websocket-driver-0.7.5/ext/websocket-driver
make "DESTDIR=" clean
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function
without a catch block, or by rejecting a promise which was not handled with .catch(). The promise
rejected with the reason "undefined".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

current directory:
/home/brobobro/.rvm/gems/ruby-2.7.2/gems/websocket-driver-0.7.5/ext/websocket-driver
make "DESTDIR="
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function
without a catch block, or by rejecting a promise which was not handled with .catch(). The promise
rejected with the reason "undefined".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

make failed, exit code 1

Gem files will remain installed in /home/brobobro/.rvm/gems/ruby-2.7.2/gems/websocket-driver-0.7.5
for inspection.
Results logged to
/home/brobobro/.rvm/gems/ruby-2.7.2/extensions/x86_64-linux/2.7.0/websocket-driver-0.7.5/gem_make.out

An error occurred while installing websocket-driver (0.7.5), and Bundler cannot continue.
Make sure that `gem install websocket-driver -v '0.7.5'` succeeds before bundling.

In Gemfile:
  grape_on_rails_routes was resolved to 0.3.2, which depends on
    rails was resolved to 5.2.6, which depends on
      actioncable was resolved to 5.2.6, which depends on
        websocket-driver

Windows 11 WSL2 Ubuntu 20.04

gcc and build essentioals installed

jcoglan commented 3 years ago

In general, as I've mentioned elsewhere (#69, #54, #35, #18) I'm not able to provide Windows support. However I notice the errors above look like they come from Node.js, which should not be involved in compiling this package at all. Do you know why those errors might be showing up?

whitehorsesoft commented 3 years ago

Just curious, does installing the Ubuntu 'ruby-dev' package resolve this issue? I was getting the same issue when only the Ubuntu 'ruby' package was installed.

andyBobro commented 3 years ago

I downgraded nodejs to 14 version and installed this gem in native wsl terminal, not in wsl terminal integrated to vs code and solved the problem