RVM hangs on 'Installing required packages' on Debian - ruby-on-rails

I installed rvm on debian 7 using the command:
\curl -L https://get.rvm.io | bash -s stable --rails
from this article:
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-an-debian-7-0-wheezy-vps-using-rvm
I get this output:
Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/debian/7/x86_64/ruby-2.1.0.tar.bz2
Checking requirements for debian.
Installing requirements for debian.
Updating system...
Installing required packages: gawk, g++, libreadline6-dev, zlib1g-dev, libssl-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev
It hangs here forever. I tried waiting about 30 min. I also tried hitting ctrl-c and running some rvm commands. rvm list known works fine, but rvm install gets me back to the same "installing requirements" and it hangs as well.
Any ideas? Googleing only seemed to bring up issues involving OSX (I'm using debian in a vbox in windows 8).
Would installing each required package indiviually via apt-get be the best move?

I faced the same issue. To resolve, just mount the installation CD that you used to install Debian and it will work.

I encountered the same issue with Debian 8. As it turns out, the installation was looking for the required packages on the Debian install CD-ROM, which wasn't inserted. To fix this, run the following command:
nano /etc/apt/sources.list
Then, comment out the line beginning with "cdrom" so that it looks like the following:
# cdrom:[Debian GNU/Linux...
You should be able to run sudo apt-get update then try installing rvm again. However, I restarted my laptop before doing so. Therefore, I can't give 100% confirmation that it works without restarting.

As i've written in comment, try installing requirements by hand, sometimes something wilk silently fail and cause such issues. As OP found, the gawk package was causing the issue.

Just remove the cdrom entry from the sources.list file. This can be done easily:
sudo sed -i '/cdrom/d' /etc/apt/sources.list
This should take care of the problem. The message is because somehow you still have the cdrom entry in your sources.list file, you can check the content of the file using:

Related

How to solve 'libcurl' not found with Rails on Windows

This is giving me a headache. I'm continuing a Rails project that started on Linux and I keep getting this when I run Puma on Ruby Mine:
Error:[rake --tasks] DL is deprecated, please use Fiddle
rake aborted!
LoadError: Could not open library 'libcurl': The specified module could not be found.
Could not open library 'libcurl.dll': The specified module could not be found.
Could not open library 'libcurl.so.4': The specified module could not be found.
Could not open library 'libcurl.so.4.dll': The specified module could not be found.
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/ffi-1.9.14-x86-mingw32/lib/ffi/library.rb:147:in `block in ffi_lib'
[...]
Now, what have I tried?
I installed Puma successfully on Windows following this steps
I downloaded curl-7.50.1-win32-mingw and put it on "C:/curl"
I added C:/curl/bin and C:/curl/include to PATH
I installed successfully curb gem with gem install curb --platform=ruby -- --with-curl-lib=C:/curl/bin --with-curl-include=C:/curl/include
I put the .dll files in Ruby bin folder, installed the certificate in curl/bin and even run the curl.exe just in case.
I rebooted the machine but I keep seeing the same error.
I do not know what to do. How to successfully install libcurl on Windows for use with Rails
Answer that worked for me (W10/Ruby2.6.0) was:
Download cURL from the following URL: https://curl.haxx.se/windows/ (I chose 64bit because that's the system I'm using)
Go into the archive and browse to /bin
Locate libcurl_x64.dll (it may be just libcurl.dll)
Extract to your local drive
Rename it to libcurl.dll if it has the _x64 suffix
Cut + paste the file into the /bin directory of your Ruby installation
I just had the same problem on Windows 7 x64 and answered about it here. (Similar to you, I tried a lot of things that I thought should work but didn't.)
What worked was:
To take a libcurl.dll from one of the packages found here, https://curl.haxx.se/download.html#Win64, and put it on the PATH.
(Link was updated, but originally pointed to version 7.40)
I just put it under \ruby24\bin\
Maybe for you it's C:\Ruby24-x64\bin
(Here are things I tried that didn't work:)
Putting on the PATH: the cygcurl-4.dll obtained from the current Curl Download Wizard
Renaming the above cygcurl-4.dll to libcurl.dlland putting it on the PATH
Installing the msys2 package libcurl-devel 7.57.0-1
Renaming the msys-curl-4.dll (from msys2 found at msys64\usr\bin) to libcurl.dll
I didn't try building curl / libcurl from the latest source because I already have the latest according to pacman -Ss libcurl:
msys/libcurl 7.57.0-1 (libraries) [installed]
Multi-protocol file transfer library (runtime)
msys/libcurl-devel 7.57.0-1 (development) [installed]
Libcurl headers and libraries
More details about this in these other questions:
jekyll serve dependency error - Could not open 'lib curl'
Typhoeus Windows installation
Rails Typhoeus Curl Trouble
how to install libcurl on windows 7 64bit
I had the same issue and tried the same steps that OP has listed. After breaking my head, cursing the existence of windows for some time and almost convincing the client to shift to a nix server I figured the libcurl.dll that I downloaded from https://curl.haxx.se/ (as suggested in all related posts) was corrupt.
Downloaded the one provided here http://www.dlldownloader.com/libcurl-dll/ and viola the ffi was able to load this one.
Hope this helps anyone else facing this issue
For anyone running Ruby 2.5 on Windows, my solution was similar to the top solutions however I had to move it to place the file in both the \bin folder and \bin\ruby_builtin_dlls folder to work.
Some other things is that I downloaded the 64bit version and changed its name to libcurl.dll. Also make sure to restart your IDE/terminal and then try to start the server again.
None of the solutions worked for me - no matter what I tried, libcurl failed to load.
I then did the following:
Created a mini Ruby program that just tried loading the dll:
require 'ffi'
FFI::DynamicLibrary.open("libcurl", FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL)
Ran procmon and filtered by ruby.exe process and any path containing "dll"
As a result, I saw the following:
C:\Ruby27-x64\bin\libzstd.dll - NAME NOT FOUND
That gave me an idea that I was missing a dependency. The libzstd.dll file is part of the mingw-w64-x86_64-zstd package but luckily I just had it sitting on my drive elsewhere (as part of the GIMP installation).
I copied libzstd.dll to C:\Ruby27-x64\bin and the problem was solved. Of course, I had libcurl.dll in my path already (got it from https://curl.haxx.se/windows)
I want to use wpscan, but i get libcurl error
OK, if you also get the same error, then in a very easy way I will try to give the solution.
Just copy the libcurl.dll file to system32 if your windows is 32 bit,
If your windows 64 bit copied to syswo64.
Good luck.
Well, the issue is caused by a missing lib as said in the error, So the solution is to download the lib here: http://www.dlldownloader.com/libcurl-dll/ and navigate to the ruby folder under bin and drop it there make sure to rename the downloaded .dll file to this exact one: libcurl.dll else won't work even after.
The solution which worked for me was download the dll, keep the exact name libcurl.dll and copy it to c:\windows\system32
If you're using WSL on Windows 10 (Make sure to update to Ubuntu 16.04) the following instructions worked perfectly for me. You might need to completely wipe what you have installed however.
Within bash:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev postgresql-client-common postgresql-client libpq-dev
And then to build our path and plugin directory for rbenv:
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
Finally we come to ruby:
rbenv install 2.4.1
rbenv global 2.4.1
Then bundler:
gem install bundler
rbenv rehash
Now our prerequisites:
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
And then finally Rails:
gem install rails
rbenv rehash

Cannot connect PhantomJS and Poltergeist in Rails application

I've followed the instructions on Poltergeist github page but i keep getting an error that my PhantomJS version is wrong.
Specifically, it says:
Could not find an executable 'phantomjs' that matched the requirements '~> 1.8', '>= 1.8.1'. Found versions were {"/home/marko/projects/irs_machine/bin/phantomjs"=>"50"}.
Now, I have downloaded phantomjs v1.8.1 (and later v1.9.2) so the version is correct. This is really driving me crazy. I use Ubuntu 13.04, but I doubt that's the reason.
Googling for the error returns nothing of use.
Any ideas?
I've solved it!
What I found to be very strange was the fact that the error reported the phantomjs version to be "50" which is impossible.
I've tracked the error down to the "cliver" gem, a gem that detects versions of installed programs. It does so by regex matching the desired version string to the result of
{command} -v
Now, when I run phantomjs -v i get "1.8.1", so what was happening? On closer inspection "1.8.1" wasn't all that I was getting back! To be precise, I got this:
phantomjs -v
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
1.8.1
I had a fontconf error, and sure enough, the first number it contained was "50". Cliver matches against standard output, so it couldn't get a proper version because the system was writing errors out.
Once I reconfigured the 50-user.conf not to use line 9, the error was gone and poltergeist started working as expected.
In my case, using apt-get to install PhantomJS was installing an older version of PhantomJS. I had to manually install PhantomJS by downloading the tarball, unpacking it, and creating links to the executable in /bin:
If you haven't already, remove the outdated version of PhantomJS you have installed.
Using apt-get, the command for me was sudo apt-get remove phantomjs.
Download the tarball from http://phantomjs.org/download.html.
(You can use, for example, wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2 to download the x86 version of PhantomJS 1.9.7 from the command lineto the current working directory.)
Unpack the tarball in your home directory.
According to https://askubuntu.com/a/25962/168631, the command is tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2, depending on which version you downloaded.
Create symbolic links to the phantomjs executable in your /bin.
Following these instructions, I ran:
sudo ln -s <snip>/<unpacked_tarball>/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s <snip>/<unpacked_tarball>/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s <snip>/<unpacked_tarball>/bin/phantomjs /usr/bin/phantomjs
i also faced the same issue and resolved it by using the phantomjs gem ,which will install the phantomjs based on the platform you are working.
first remove the platform specific phantomjs ,so if you are using ubuntu
sudo apt-get --purge remove phantomjs
sudo rm /usr/bin/phantomjs
sudo ln -s /node_modules/phantomjs/lib/phantom/bin/phantomjs /usr/bin/phantomjs
Try to move phantomjs to your /bin directory.

Can't get Homebrew and git to work the way I want them to

First off, I'm sorry for any silly mistakes on my part. I'm just starting with OneMonthRails, and this is all very new to me. My problem is with Homebrew and git. I'm told that my problem has to do with environmental variables, and I've done enough research to be confident this is correct. Ok, here's the details:
I've tried to install Homebrew, but ran into a snag with Xcode being absent. Was running OSX 10.6.8, and had to upgrade to at least 10.7.x to install the latest Xcode. I upgraded to OSX 10.8.4 and installed Xcode and reran the following line
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
I get the following script:
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help
I am installing Homebrew so that I can install ImageMagick in order to run the Paperclip gem, so I take the advice of my Terminal about running $ brew doctor.
$ brew doctor
produces the line
Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools" package provided by Apple.
Warning: Broken symlinks were found. Remove them with `brew prune`:
///long list of broken symlinks///
Warning: An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git
I want to know what my git version is so I run the following script:
$ git --version
and that produces the following line:
git version 1.7.9.6
I identify where my git is located:
$ which git
and that brings:
/opt/sm/pkg/active/bin/git
After some more research, I find out that I can upgrade my git with the following script:
$ brew install git
The final line of the resulting script is a warning:
Warning: This keg was marked linked already, continuing anyway
==> Summary
🍺 /usr/local/Cellar/git/1.8.3.2: 1325 files, 28M, built in 45 seconds
I verify my git upgrade
$ git --version
git version 1.7.9.6
sudo think...maybe I need to run upgrade instead of install.
///restart computer///
$ brew upgrade git
Error: git-1.8.3.2 already installed
hmm... try doctor again
$ brew doctor
Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools" package provided by Apple.
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
$ git --version
git version 1.8.3.2
YAY! I DID SOMETHING RIGHT! Now to finish with Homebrew so I can move on to installing ImageMagick:
$ brew doctor
Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools" package provided by Apple.
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Arrg... I just installed Xcode. How do I install Command Line Tools? And what is this config Warning? I check it on StackOverflow, and it leads me here:
(.../questions/15225312/brew-doctor-gives-out-warnings)
I don't exactly know what I'm doing, so the following is kinda stupid
$ $PATH
nope
$ echo $PATH
nothing...
$ export PATH=/sm/pkg/active/bin/
nothing
$ export PATH= /sm/pkg/active/bin/
-bash: export: `/sm/pkg/active/bin/': not a valid identifier
(notice the space after the =)
I realize just how much I don't know what I'm doing, so I ask for help
$ brew help
-bash: brew: No such file or directory
uh oh...
$ brew doctor
-bash: brew: No such file or directory
I think I broke my computer, guys. What should I do??? I need to get Homebrew functioning so that I can install the ImageMagick image processor and use the Paperclip gem in Rails.
:((
I know it's super frustrating and some what confusing to get this all to work. Been there, done that.
There are a couple things at play here, so take them one at a time (in fact. I'm just guessing some stuff so I'm happy to update this answer as you let me know more)
Let's start with:
Warning: Experimental support for using Xcode without the "Command Line Tools". You have only installed Xcode. If stuff is not building, try installing the "Command Line Tools" package provided by Apple.
Installing command line tools is highly recommended. It's going to install gcc and other tools that help compile the code that homebrew downloads.
Open Xcode.
Open Preferences.
On the top bar, choose "Downloads"
Install "Command line tools"
Second, I'm not sure how you quite blew away your path. I would first see if you just messed up this terminal and if you close it and start a new terminal window if your PATH is okay.
However, failing that, here's a path that has some basic search paths that will help you get on your way:
export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/sbin
You should probably check your .zshrc/.zsh_profile or .bashrc/.bash_profile and see what you are setting your PATH to.
You won't want the space on either side of the = when you are typing that command.
I recently tried the upgrade from 10.6 to 10.8 (to install rails, bundler, RVM) and had lots of the same problems with brew and RVM conflicting AND having their own separate problems (PATH, permissions/non-writable folders, old versions XCode etc). It went off without problems after i tripled backed up everything (TMachine, git and manually copying selected directory trees) and did the clean Mountain Lion install off a USB drive.
If you're only having PATH problems, you could edit it manually/temporarily (until next time .bashrc is run, per comment to the answer: Brew doctor gives out warnings

"The program 'ruby' is currently not installed" error after reboot

After the reboot which was required to update all the packages,
ruby -v
doesn't work. It says rails is not installed either, but I guess it should be the similar issue. when I do:
sudo apt-get install ruby
It says the newest version is already installed.
When I do:
dpkg -L ruby
I get the following output:
/.
/usr
/usr/bin
/usr/share
/usr/share/doc
[and other stuff..]
But I realized $PATH already includes /usr/bin:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
:/sbin:/bin:/usr/games:/home/ubuntu/.rvm/bin
May I know why I'm still getting the following error message?:
The program 'ruby' is currently not installed. You can install it by typing:
sudo apt-get install ruby
My .bashrc already has this too:
PATH=$PATH:$HOME/.rvm/bin
dpkg will be checking in a database that it maintains, whereas trying to execute ruby uses the PATH. If I recall correctly, Ubuntu has a bash handler configured to execute when any command is unresolvable; it seems that it just displays that generic message rather than checking with dpkg first.
It is possible that ruby has disappeared from your filesystem (or at least the directory it previously resided in), or that your PATH was changed.
What do you get if you execute "which ruby" and "where ruby"?
Lastly, Ubuntu can complain that a program cannot be found when it is present. This occurs when running a 64-bit version of Ubuntu, without the necessary x86 libraries installed, and trying to execute a 32-bit binary. However, I recall the error message being more along the lines of "file not found".

Getting a "bad interpreter" error when using brew

I'm getting this error when I try to run any brew command.
Holger-Sindbaeks-MacBook-Air:~ holgersindbaek$ brew help
-bash: /usr/local/bin/brew: /usr/bin/ruby: bad interpreter: No such file or directory
I have absolutely no idea on how to fix this and been searching for a long time without answer.
I got this error (much the same):
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 26: /usr/local/Library/brew.rb: Undefined error: 0
and fixed by the solution below:
Open brew.rb:
$ sudo vim /usr/local/Library/brew.rb
Change the first line's 1.8 to Current:
Before:
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
After:
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0
Then brew works for me. Hope it helps if any other one got this issue. :)
If you get the error
Homebrew requires Leopard or higher. For Tiger support, see:
https://github.com/mistydemeo/tigerbrew
change the MACOS check from <10.5 to <10.
Tip by #TimCastelijns:
10.5 doesn't work because in comparison, it's higher than 10.10 (.1 vs .5). I added a check (and MACOS_VERSION != 10.10) instead of lowering from 10.5 to 10.
What you are getting means that Homebrew has not been able to locate the Ruby interpretter at the specified location.
Install Apple Developer Kit (comes with Xcode) which should be available to you as an optional install (or you can simply download it from Apple). This will install the Ruby interpreter for you.
In case you already have Xcode installed, this means that one of these things is happening:
You have a broken Ruby installation
You have more than one Ruby installation
Your installation has not been configured properly.
To identify if this is the first case, you can run ruby and see if you get any response.
If you don't, your installation is broken and you need to reinstall it. If you do, you then run which ruby. This should give you the absolute path to your Ruby executable. If this is anything other than /usr/bin/ruby then homebrew (and a bunch of other programs) will not be able to find it.
In case you have not ever tampered with your Ruby installation, you can check to see if /usr/bin/ruby already exists or not: cat /usr/bin/ruby. If you get No such file or directory, then you can easily create a symbolic link to your Ruby installation. Assuming the output of which ruby to by /usr/local/bin/ruby, you create the symbolic link this way: sudo ln -s /usr/local/bin/ruby /usr/bin/ruby and all should be well.
If there is a file at that location, you can run file /usr/bin/ruby to see if it's a real file, a symbolic link, or a corrupted file. If it is a symbolic link, your installation should be working, and since it's not, it probably is either a corrupted symlink or it's a bogus file.
You can remedy that by first deleting it (sudo rm /usr/bin/ruby) and then creating a new symlink to the correct location (sudo ln -s /usr/local/bin/ruby /usr/bin/ruby).
If non of the above works, you should consult the homebrew team after a clean install of Xcode and removing any traces of a Ruby installation on your system.
EDIT
Alternatively, as pointed out by the other answers, the issue might be because of a bad ruby version in your Homebrew settings.
A quick fix might be updating your Homebrew:
cd /usr/local
git pull -q origin refs/heads/master:refs/remotes/origin/master
If this does not help, you might want to get your hands dirty and manually fix the problem by:
Editing brew.rb from /user/local/Library/brew.rb
Changing /1.8/ to /Current/ in the first line, which will cause the hashbang to point to the current Ruby version as the executor
If this does not help, either, you can also modify the MACOS check and change it from 10.5 to 10 to avoid the infamous "Homebrew requires Leopard or higher" error.
DISCLAIMER
A bunch of thanks to other contributors in the answers below and their commenters. I am not committing plagiarism, simply aggregating the answers into one integrated article to help others.
Fix:
sudo gem install cocoapods
At the risk of oversimplifying things, try running
gem install bundler
I was transitioning my Ruby environment from RBENV to RVM and it worked for me.
This happened because I needed to update brew - in the updated version it already uses Current ruby
cd /usr/local
git pull -q origin refs/heads/master:refs/remotes/origin/master
This solved the problem
You need to change the path for Ruby.Framework
I solved it with commands as mentioned.
brew install cocoapods --build-from-source
brew link --overwrite cocoapods
If you have a lower version below Xcode 11, you have to remove it before you use the above commands.
Reference: Ruby Framework issue
None of the above worked for me, so I kept browsing and found this answer,
https://stackoverflow.com/a/24225960/1359088
which did fix brew for me. He says in step 1 to install XCode 6 command line tools, but doesn't say how; use this command:
xcode-select --install
I got the same issue when updated to MacOSX High Sierra & using Xcode 9 with that. High Sierra update ruby gem to version 2.3 but xcpreety command of Xcode 9 still using Ruby 2.0 which is unable to find now & gives bad interpreter.
Just go to Terminal & run
sudo gem install xcpretty
Restart Xcode & do fresh clean build it works for me.
Hope it helps!!!
After upgrading to macOS High Sierra, get it fixed with following commands:
sudo gem install cocoapods
In my case seems like fastlane installed incorrectly with brew install fastlane system didn't write correct path to fastlane. I fixed it with alias fastlane=~/.fastlane/bin/fastlane
I solved it with commands as mentioned.
1.) Uninstall your GEM.
gem unistall GEM
2.) Then Install your GEM.
sudo gem install GEM -n /usr/local/bin
I got bad interpreter: No such file or directory error when used xcpretty and xcpretty-travis-formatter on upgraded MacOS.
To solve it
gem install xcpretty
gem install xcpretty-travis-formatter
That is why I can recommend you to reinstall failed component gem install <name>
#For example error looks like
/usr/local/bin/xcpretty-travis-formatter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
#use
gem install xcpretty-travis-formatter

Resources