Install gem linecache19 : syntax error near unexpected token - ruby

I have tried to install a couple of ways but failed each time. Can you help? The outcome is always the same:
...
creating Makefile
make
generating trace_nums-i386-mingw32.def
/usr/bin/sh: -c: line 1: syntax error near unexpected token `Init_trace_nums.sub(/'
/usr/bin/sh: -c: line 1: `C:/Ruby193/bin/ruby -e \puts EXPORTS, + Init_trace_nums.sub(/\..*\z/,)\ > trace_nums-i386-mingw32.def'
make: *** [trace_nums-i386-mingw32.def] Error 258
I've seen several related posts, but none with this message. I'm using pik, in case that makes a difference.
I don't know how to interpret this error message. If I should be opening one of the gem source files and correcting its syntax, what file has this issue? (I've opened several in search.)
Specs: Windows 7, Ruby 1.9.3, Rails 3.2.3
What I've tried:
I have tried on the command line:
gem install linecache19
I have tried adding it to my Gemfile, then calling bundle install
gem 'linecache19'
I have tried downloading it from rubyforge and calling:
gem install linecache19-0.5.13.gem

I succeeded at this after almost a month. The solution was to use Ruby DevKit. Instructions for its installation (don't just unpack it) are here.

Related

Solargraph not working in Visual Studio Code

I have the following error in my VS Code:
[Error - 3:51:12 PM] Starting client failed
/usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem solargraph (>= 0.a) with executable solargraph (Gem::GemNotFoundException)
from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
from /usr/local/bin/solargraph:23:in `<main>'
I currently use rbenv and have as global and only Ruby version 2.6.3
What seems to be the problem here? why do I see a ruby/2.6.0/ above if the version is 2.6.3?
Thanks for the help!
If all else fails, you can try setting solargraph.commandPath to the executable's absolute path. Running which solargraph should give you the path to use.
I found the solution you should gem install solargraph. If not work and get this error
ERROR: Loading command: install (ArgumentError)
unknown encoding name - CP720
ERROR: While executing gem ... (NoMethodError)
undefined method "invoke_with_build_args" for nil:NilClass
Try to execute by administrator in CMD
chcp 1252
Then try to install gem again
Enjoy!
Try executing
solargraph -v
from the VS Code terminal.
If that gives an error try
gem install bundler:1.17.3
I was getting errors with every keystroke similar to:
[Error - 6:08:49 PM] Request textDocument/completion failed.
Message: [ArgumentError] wrong number of arguments (given 1, expected 0)
Code: -32603
I'm using VSCodium, I changed a configuration in order to install "official" extensions. I re-installed all extensions, including Solargraph, that's when this started happening.
In the end, restarting editor via Developer: Reload Window fixed it.

unpacking, editing and rebuilding ruby gem

I need to edit the contents of a ruby gem, call him a.gem.
I used gem unpack a.gem ,got the insides of it, and gem unpack --spec a.gem to get a .gemspec.
I've added a new file, updated the files: section of the .gemspec to include it. I've put a.gemspec inside the folder resulted from unpacking the gem.
Now I'm try to gem build a.gemspec, and I'm getting the following error:
Invalid gemspec in [logstash-output-jdbc-5.2.1-java.gemspec]: logstash-output-jdbc-5.2.1-java.gemspec:1: syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '('
--- !ruby/object:Gem::Specification
^
logstash-output-jdbc-5.2.1-java.gemspec:2: syntax error, unexpected ':', expecting end-of-input
name: logstash-output-jdbc
^
ERROR: Error loading gemspec. Aborting.
What am I doing something wrong? I'm not a ruby programmer and I just need to edit something there.
Try a simpler workflow
gem open my_gem
This will open the installed gem's source code in your EDITOR. Make your edits. Save, restart your app to see the effects.
A little late for OP, but these steps worked for me. Perhaps they'll help someone else:
gem spec pkg-1.2.3.gem --ruby > pkg.spec
gem unpack pkg-1.2.3.gem
mv pkg.spec pkg-1.2.3
cd pkg-1.2.3
gem build pkg.spec
Need the --ruby, otherwise the spec file is yaml.

Ruby - ERROR: While executing gem ... (URI::InvalidURIError)

Whenever I tried to install gems recently I am getting the below error
ERROR: While executing gem ... (URI::InvalidURIError)
the scheme http does not accept registry part: www-cache.reith.bbc.co.uk;htt
p: (or bad hostname?)
I am getting this error only recently. Earlier I could install all the gems without any issues. Now, only uninstalling of gems is possible.
I have gone through many solutions and I could find them not specific to my problem.
The issue is, when I copied the command sudo gem install fastlane –NV from the web, -NV contains a bad character, replace dash with a new one and it works fine

Error while trying to install vagrant-aws plugin

I'm trying to add the vagrant-aws plugin to my installation of Vagrant. Upon running this command:
vagrant plugin install vagrant-aws
I get this error message:
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
"c:/Program Files (x86)/Vagrant/embedded/bin/ruby.exe" extconf.rb
creating Makefile
make "DESTDIR="
generating generator-i386-mingw32.def
/bin/sh: -c: line 0: syntax error near unexpected token `x86'
/bin/sh: -c: line 0: `/c/Program\ Files\ (x86)/Vagrant/embedded/bin/ruby -e "puts 'EXPORTS', 'Init_generator'" > generator-i386-mingw32.def'
make: *** [generator-i386-mingw32.def] Error 2
Gem files will remain installed in C:/Users/Steve/.vagrant.d/gems/gems/json-1.8.2 for inspection.
Results logged to C:/Users/Steve/.vagrant.d/gems/gems/json-1.8.2/ext/json/ext/generator/gem_make.out
At first I thought I would need to manually install Ruby and Gem in order to fix this, but then I realized that Vagrant's Bundler system should automatically take care of all this. I'm at a loss and would appreciate any help.
Ahh.. Windows and Linux build/make tools will never get along.
As you can see from the error: /bin/sh: -c: line 0: syntax error near unexpected token ``x86' - The problem is with the parentheses characters in the path.
I think newer Vagrant version solved these problems by installing Vagrant in Program Data directories.
I feel your pain, I stayed up for awhile fighting with this issue. I had just switched over to Linux Mint 17.1 Rebecca from being a long time windows user.
Vagrant version 1.7.2, pretty fresh install of Mint 17.1
Kept getting that same error when trying to install various plugins for vagrant, mainly hostsupdater but I bet this fixes all the issues as it is the same error. I read tons of threads and answers and this is what ended up working.
1: Followed this guide and installed Ruby 2.2.0
http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you
Note: Make sure you visit the sites where he links off to the README for installing ruby, his copy paste for code is messed up.
2: You were expecting more, nope!
Installing all plugins just worked perfect after that, did need to use sudo though but other than that.
Hope this saves someone a ton of time looking...

Error installing gems that use native extensions on Ubuntu, Ruby 1.9.2 via RVM

I get an error while trying to install the ffi gem:
~ - 16:54>gem i ffi
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
rake RUBYARCHDIR=/home/mdemare/.rvm/gems/ruby-1.9.2-p136/gems/ffi-1.0.6/lib RUBYLIBDIR=/home/mdemare/.rvm/gems/ruby-1.9.2-p136/gems/ffi-1.0.6/lib
/home/mdemare/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:370:in `bin_path': can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)
from /home/mdemare/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in `<main>'
Gem files will remain installed in /home/mdemare/.rvm/gems/ruby-1.9.2-p136/gems/ffi-1.0.6 for inspection.
Results logged to /home/mdemare/.rvm/gems/ruby-1.9.2-p136/gems/ffi-1.0.6/gen/gem_make.out
I'm getting frequent errors of all kinds while installing gems with native extensions, so I assume that there's something broken with my Ubuntu installation, but I've no idea what. I'll post any information you need to diagnose the problem.
EDIT: When I cd to the ffi gem (mentioned in the second but last line), and run the rake line in line 6, I get "Could not find RubyGem rake-compiler".
After gem i rake-compiler, and run rake again, I get this:
configure: error: source directory already configured; run "make distclean" there first
make: *** [/home/mdemare/.rvm/gems/ruby-1.9.2-p136/gems/ffi-1.0.6/build/x86_64-linux/ffi_c/1.9.2/libffi/.libs/libffi_convenience.a] Error 1
rake aborted!
Command failed with status (2): [make...]
Update:
These are my rake gemspecs:
~ - 10:59>find ~/.rvm/ -name 'rake-0.8.7.gemspec'
~/.rvm/gems/ruby-1.9.2-p136/specifications/rake-0.8.7.gemspec
~/.rvm/gems/ruby-1.9.2-p136#global/specifications/rake-0.8.7.gemspec
~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/gems/1.9.1/specifications/rake-0.8.7.gemspec
The last one is where gem looks, but that gemspec is different from the first one, and doesn't include the executable. Copying the long one doesn't quite solve the problem though - I get a file not found for the rake executable.
This caused me a ton of aggravation at the Boston Hack Day when trying to install Vagrant (for which FFI is a dependency). I ended up wasting so much time that I switched machines to work around the problem.
After the fact, I found a hack that works (although I'm sure there's a better solution). The file that the error message is complaining about
~/.rvm/gems/ruby-1.9.2-p180/bin/rake
differs from other similar copies in that it's missing path setup stuff at the head, so I copied these lines from one of the files that had them:
[genericized per #danv's answer below. Thanks for the improvement!]
ENV['GEM_HOME']=ENV['GEM_HOME'] || '~/.rvm/gems/ruby-1.9.2-p180'
ENV['GEM_PATH']=ENV['GEM_PATH'] || '~/.rvm/gems/ruby-1.9.2-p180:~/.rvm/gems/ruby-1.9.2-p180#global'
ENV['PATH']='~/.rvm/gems/ruby-1.9.2-p180/bin:~/.rvm/gems/ruby-1.9.2-p180#global/bin:~/.rvm/rubies/ruby-1.9.2-p180/bin:' + ENV['PATH']
That fixed it for me. This was a new Ubuntu 10.10 install with no default Ruby installation (which could be part of the problem) and Ruby 1.9.2 installed using RVM. Lots of other gems installed fine, including those requiring native compilation, so the problem is something specific to FFI.
I had a similar problem, and a workaround at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=529663 helped me.
In short, try to install the gem with:
$ rake=/usr/bin/rake gem install ffi
#Tom Morris - Tried your method and it worked fine.
I inserted your path specs (modified - see below) into ~/.rvm/gems/ruby-1.9.2-p180/bin/rake after line 12.
I modified the path specs so they are generic using ~ for the user home:
ENV['GEM_HOME']=ENV['GEM_HOME'] || "~/.rvm/gems/ruby-1.9.2-p180"
ENV['GEM_PATH']=ENV['GEM_PATH'] || "~/.rvm/gems/ruby-1.9.2-p180:~/.rvm/gems/ruby-1.9.2-p180#global"
ENV['PATH']="~/.rvm/gems/ruby-1.9.2-p180/bin:~/.rvm/gems/ruby-1.9.2-p180#global/bin:~/.rvm/rubies/ruby-1.9.2-p180/bin:"+ ENV['PATH']
Thanks for finding this fix!
Thanks #Tim Morris and #danv, your answers / comments helped. I adjusted for my setup, which is based more towards a superuser environment. Now this is what /usr/local/rvm/gems/ruby-1.9.2-p180/bin/rake looks like on my server:
require 'rubygems'
version = ">= 0"
ENV['GEM_HOME']=ENV['GEM_HOME'] || "/usr/local/rvm/gems/ruby-1.9.2-p180"
ENV['GEM_PATH']=ENV['GEM_PATH'] || "/usr/local/rvm/gems/ruby-1.9.2-p180:/usr/local/rvm/gems/ruby-1.9.2-p180#global"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
gem 'rake', version
load Gem.bin_path('rake', 'rake', version)
The installer attempts to run rake but fails when it isn't found:
can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)
You need to install the rake gem: gem install rake.

Resources