Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yarn uninitialized constant Socket::SOL_TCP

I'm trying to use yarn here and got into a problem that might be related to ruby. On executing any yarn command, I get the error .../.rvm/gems/ruby-2.3.0/gems/yarn-0.1.1/lib/yarn/server.rb:14:in <class:Server>': uninitialized constant Socket::SOL_TCP (NameError)

Error Stack:

$ yarn .../.rvm/gems/ruby-2.3.0/gems/yarn-0.1.1/lib/yarn/server.rb:14:in <class:Server>': uninitialized constant Socket::SOL_TCP (NameError) Did you mean? Socket::SO_TYPE from .../.rvm/gems/ruby-2.3.0/gems/yarn-0.1.1/lib/yarn/server.rb:6:in <module:Yarn>' from .../.rvm/gems/ruby-2.3.0/gems/yarn-0.1.1/lib/yarn/server.rb:4:in <top (required)>' from .../.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from .../.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from .../.rvm/gems/ruby-2.3.0/gems/yarn-0.1.1/bin/yarn:26:in <top (required)>' from .../.rvm/gems/ruby-2.3.0/bin/yarn:23:in load' from .../.rvm/gems/ruby-2.3.0/bin/yarn:23:in <main>' from .../.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in eval' from .../.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>' Any ideas on the cause of this?

like image 852
Guilherme Avatar asked Mar 30 '17 16:03

Guilherme


2 Answers

You should delete yarn gem:

gem uninstall yarn

and install yarn again:

yarn

yarn install v1.9.2. success Already up-to-date. ✨ Done in 0.77s.

And after that, last step

yarn build
  • 248 hidden modules ✨ Done in 4.95s.
like image 169
AlexSh Avatar answered Oct 25 '22 08:10

AlexSh


I was getting the same error in ruby-2.2.4. I was able to overcome the problem by updating ruby to the latest version.

It looks like the Socket Server is crashing, so older ruby version may have an updated socket class?

like image 29
Phil Avatar answered Oct 25 '22 08:10

Phil