I am trying to deploy my Rails app on Heroku and having an error.
I am on macOS and, I have run are
replace REPLACE_ME_OS/REPLACE_ME_ARCH with values as noted below
$ wget https://cli-assets.heroku.com/heroku-cli/channels/stable/heroku-cli-linux-x64.tar.gz -O heroku.tar.gz
$ tar -xvzf heroku.tar.gz
$ mkdir -p /usr/local/lib /usr/local/bin
$ sudo mv heroku-cli-v6.x.x-darwin-64 /usr/local/lib/heroku
$ sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
and when I run heroku -v, I am getting
/usr/local/bin/heroku: line 29: /usr/local/lib/heroku/bin/node: cannot execute binary file
Any help?
You've downloaded the Linux version, not the macOS version. Use the macOS installer available directly from Heroku or use Homebrew:
brew tap heroku/brew && brew install heroku
Related
I tried:
if ! command -v ruby &> /dev/null
then
# - proverbot's version
# First, install Ruby, as that is for some reason required to build
# the "system" project
# git clone https://github.com/rbenv/ruby-build.git ~/ruby-build
# mkdir -p ~/.local
# PREFIX=~/.local ./ruby-build/install.sh
# ~/.local/ruby-build 3.1.2 ~/.local/
# - u-pycoq's version
# sudo apt-get install ruby-full
sudo apt-get install rbenv
rbenv init
eval "$(rbenv init - bash)"
echo 'eval "$(rbenv init - bash)"' >> ~/.bashrc
sudo apt-get install ruby-build
# ruby-build 3.1.2
rbenv install 3.1.2
rbenv global 3.1.2
ruby -v
else
echo "Error: failed to install ruby"
fi
But I get my Ruby build is not up-to-date perhaps, but when I install it, it is up-to-date. Therefore, why is the proverbot's attempt 3.1.2 if it doesn't exist?
It was inspired from: https://superuser.com/questions/340490/how-to-install-and-use-different-versions-of-ruby
It seems it works with 2.7.1, but not with 3.1.2.
sudo apt-get install rbenv
rbenv init
eval "$(rbenv init - bash)"
echo 'eval "$(rbenv init - bash)"' >> ~/.bashrc
sudo apt-get install ruby-build
# mkdir -p ~/.local
# PREFIX=~/.local
# sh ~/ruby-build/install.sh
mkdir -p ~/.local
ruby-build 2.7.1 ~/.local
rbenv global 2.7.1
# ruby-build 2.3.1p112 ~/.local/
# ruby-build 3.1.2 ~/.local/
# rbenv global 3.1.2
ruby -v
bot#513314bdda2a:~/ruby-build$ ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [aarch64-linux-gnu]
Main command that fails
I think this is the main command that fails after rbenv and ruby-build are installed:
rbenv install 3.1.2
with
ruby-build: definition not found: 3.1.2
See all available versions with `rbenv install --list.
If the version you need is missing, try upgrading ruby-build.
Might my version of Ubuntu be the issue?
I tried it in a different server outside my Docker container and Ruby works. In the Docker container it says it's:
bot#513314bdda2a:~/ruby-build$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Is that an issue?
I tried updating ruby-build
I ran sudo apt-get update then sudo apt-get upgrade ruby-build then mkdir -p ~/.local then ruby-build 3.1.2 ~/.local/ and the error is ruby-build: definition not found: 3.1.2
I tried a bunch of Ubuntu's, but it failed
#!/usr/bin/env bash
# - Get the Ubuntu version for the Ubuntu image
#docker run -it --rm ubuntu:20.04 /bin/bash
docker run -it --rm ubuntu:18.04 /bin/bash
apt-get update && apt-get install -y lsb-release && apt-get clean all
lsb_release -a
#apt-get install git
apt-get update
apt-get upgrade ruby-build
apt-get install rbenv
apt-get install ruby-build
rbenv install 3.1.2
# - Get Ubuntu version for the 'miniconda3' Docker image
docker run -it --rm continuumio/miniconda3:latest /bin/bash
#sudo apt-get install lsb-release
#apt-get install lsb-release
apt-get update && apt-get install -y lsb-release && apt-get clean all
lsb_release -a
Output of ruby-build https://gist.github.com/brando90/8a40e83df107f5a915ba105d9fb0121c
$ ruby-build --definitions
1.8.5-p52
1.8.5-p113
...
The gist is that all 3.x.x are missing.
I tried updating ruby-build manually, but it failed
I did do:
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
then
git -C "$(rbenv root)"/plugins/ruby-build pull
Then I installed 3.1.2 with rbenv. It seemed to succeed, but then ruby --version doesn't seem right(?).
bot#e3a50e4f740f:~$ rbenv install 3.1.2
To follow progress, use 'tail -f /tmp/ruby-build.20221207002433.1304.log' or pass --verbose
Downloading ruby-3.1.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.2.tar.gz
Installing ruby-3.1.2...
Installed ruby-3.1.2 to /home/bot/.rbenv/versions/3.1.2
bot#e3a50e4f740f:~$ ruby --version
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [aarch64-linux-gnu]
bot#e3a50e4f740f:~$ rbenv global 3.1.2
bot#e3a50e4f740f:~$ ruby --version
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [aarch64-linux-gnu]
Option: Official rbenv instructions
Alas, that didn't work :frowning:
$ rbenv install 3.1.2
rbenv: no such command `install'
I did:
mkdir ~/.rbenv
cd ~/.rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc
bash
# exec $SHELL
rbenv install 3.1.2
Using the official instructions: Seamlessly manage your app’s Ruby environment with rbenv, Basic Git Checkout
Is it probably best to use a Ruby Docker container? But how do I get one with the specific version I want 3.1.2 (or any specific version)?
All options I tried to install ruby on a Docker container with specific version 3.1.2, likely better to just use a Ruby image instead, any recommendations for 3.1.2?
An idea for a bounty: force insert the FROM ruby:3.1.2 image into running container
I still can't install Ruby on a already-running container :(, is it possible to layer on top of the running image the ruby 3.1.2 image into the running container?
References:
Crossposted: Why can't I install Ruby 3.1.2 in a Linux Docker container?
All attempts are documented at ruby_install_ubuntu.sh - the Discord channel for Ruby was really helpful, even though we didn't solve it: https://discord.com/channels/518658712081268738/650031651845308419
This doesn't work on an Ubuntu Docker container which is the title of the question, but it at least worked on the HPC with Ubuntu I was using, so it can still be useful for future readers, a real answer on an Ubuntu Docker container is still needed and wanted.
# - install rbenv for installing the Ruby interpreter
mkdir ~/.rbenv
cd ~/.rbenv
git clone https://github.com/rbenv/rbenv.git .
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc.user
echo 'eval "$(rbenv init -)"' >> ~/.bashrc.user
exec $SHELL
bash
source ~/.bashrc.user
rbenv -v
# - install ruby-build
mkdir ~/.ruby-build
cd ~/.ruby-build
git clone https://github.com/rbenv/ruby-build.git .
export PATH="$HOME/.ruby-build/bin:$PATH"
echo 'export PATH="$HOME/.ruby-build/bin:$PATH"' >> ~/.bashrc.user
exec $SHELL
bash
source ~/.bashrc.user
ruby-build --version
# - install ruby without sudo -- now that ruby build was install
mkdir -p ~/.local
# ruby-build 3.1.2 ~/.local/
rbenv install 3.1.2
rbenv global 3.1.2
ruby -v
which ruby
Given the giant effort I've put so far, I think the best is just to rebuild the Docker image from scratch, starting from all the Docker images you need. For me I need to start from these:
FROM continuumio/miniconda3
# FROM --platform=linux/amd64 continuumio/miniconda3
#FROM ubuntu:20.04
#FROM ubuntu:18.04
FROM ruby:3.1.2
But rebuilding the image, I tested to see if the right Ruby image was available once I started the Ruby 3.1.2 container (if you want a different one, I assume going to the Docker website for Ruby works or try different version tags or do latest). Output:
(meta_learning) brandomiranda~ ❯ docker run -it --rm ruby:3.1.2 bash
Unable to find image 'ruby:3.1.2' locally
3.1.2: Pulling from library/ruby
077c13527d40: Pull complete
a3e29af4daf3: Pull complete
3d7b1480fa4d: Pull complete
426e8acfed2a: Pull complete
7301bf329e1e: Pull complete
1e6ce022773b: Pull complete
08fd3b7f7d99: Pull complete
2a797222ff77: Pull complete
Digest: sha256:7681a3d37560dbe8ff7d0a38f3ce35971595426f0fe2f5709352d7f7a5679255
Status: Downloaded newer image for ruby:3.1.2
root#70d03f6408cd:/# ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [aarch64-linux]
You can use rvm instead of rbenv.
website: https://rvm.io. it works on docker.
here are the commands for ubuntu docker image
curl -sSL https://get.rvm.io | bash -s stable
rvm install 3.1.2
ruby -v // 3.1.2
Running the following command from http://brew.sh/:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
...result in:
-e:192: syntax error, unexpected '.', expecting $end
.map { |d| File.join(HOMEBREW_PREFIX, d) }
^
I'm using zsh on Mac OS 10.6.
ok so to install manually through terminal do
$ cd /usr/local
$ mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
then you need to change your bash_profile like this:
$ echo 'export PATH="/usr/local/homebrew/bin:$PATH"' >> ~/.bash_profile
you might need to change permissions to the homebrew folder as well:
$ sudo chown -R $(whoami) /usr/local/homebrew
this worked for me
The official homebrew install command use some bashism. The easiest way to solve this is to run the homebrew install command with bash -c in front of it :
bash -c '/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
Fast forward to 2020 and homebrew is no longer ruby based, but bash-based. Also, it officially only supports 10.13 or higher, while keeping an eye out for 10.9 users.
The new way to get homebrew on 10.6 or lower is by using TigerBrew:
https://github.com/mistydemeo/tigerbrew
This is a maintained fork of homebrew, with the purpose of offering support for 10.4-10.7.
After installing tigerbrew, install a newer curl: brew install curl.
That should fix any ssl issues.
I'm trying to install italian language pack on a VM instance with Debian. I've tried almost everything but it still can't find the language pack.
$ apt-get update
$ apt-get install language-pack-it-base
$ apt-get install language-pack-it
It returns:
E: Unable to locate package language-pack-it
It's the same with other languages.
Any hint?
To install language-pack-it-base:
$ wget http://archive.ubuntu.com/ubuntu/pool/main/l/language-pack-it-base/language-pack-it-base_14.10+20141020_all.deb
$ sudo dpkg -i language-pack-it-base_14.10+20141020_all.deb
To install language-pack-it:
$ wget http://archive.ubuntu.com/ubuntu/pool/main/l/language-pack-it/language-pack-it_14.10+20141020_all.deb
$ sudo dpkg -i language-pack-it_14.10+20141020_all.deb
Verify the installation of the packages using dpkg -l
$ dpkg -l | grep language-pack-it
‘ii’ status indicates a successful installation.
If you get dependency errors during the installation, run the command below and re-install the packages.
$ sudo dpkg --configure -a
I installed homebrew today without really knowing what I was doing, and now my scikit-learn package is broken. I want to undo everything that I did by uninstalling homebrew, and tried following the tips here:
https://github.com/Homebrew/homebrew/wiki/FAQ
However, I think homebrew installed into /usr/bin/local, and not /usr/bin/, so I'm not sure I can use the instructions in the link.
When I initially installed homebrew (ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"), I got the following messages:
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/lib/pkgconfig
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7
Can I just delete the files in
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
I'm terrified of screwing something up in the uninstallation process.
Incidentally, would uninstalling homebrew even restore my system to what it was before? How would I go about doing that?
This worked for me
Official brew uninstalling steps:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
But /usr/bin/ruby is just symlink in order to find your ruby you need to type
which ruby
Which will give you /snap/bin/ruby
So then just use this :
/snap/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
This is covered in the homebrew FAQ:
https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md#how-do-i-uninstall-homebrew
It specifies a script you can run to do it. You should run that script. As of right now, the script says something like:
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
/usr/bin/which -s git || abort "brew install git first!"
test -d /usr/local/.git || abort "brew update first!"
cd `brew --prefix`
git checkout master
git ls-files -z | pbcopy
rm -rf Cellar
bin/brew prune
pbpaste | xargs -0 rm
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
test -d Library/LinkedKegs && rm -r Library/LinkedKegs
rmdir -p bin Library share/man/man1 2> /dev/null
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
rm -rf ~/Library/Logs/Homebrew
rm -rf /Library/Caches/Homebrew
Just run this code in terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Run this in the cli:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
The is the updated recommended way
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
You may gout output like this:
The following possible Homebrew files were not deleted:
/opt/homebrew/Frameworks/
/opt/homebrew/bin/
/opt/homebrew/etc/
/opt/homebrew/include/
/opt/homebrew/lib/
/opt/homebrew/opt/
/opt/homebrew/sbin/
/opt/homebrew/share/
/opt/homebrew/var/
You may wish to remove them yourself.
To remove run:
sudo rm -rf /opt/homebrew
Clean as a whistle! 😚
I'm trying to use wicked_pdf on my prod server but it keeps failling :
RuntimeError (Failed to execute:
"/usr/bin/wkhtmltopdf" -q "file:////tmp/wicked_pdf20130709-23109-1adqx5g.html" "/tmp/wicked_pdf_generated_file20130709-23109-1ic5dbe.pdf"
Error: PDF could not be generated!
Command Error: wkhtmltopdf: cannot connect to X server
):
app/controllers/contrats_controller.rb:15:in `block (2 levels) in show'
app/controllers/contrats_controller.rb:11:in `show'
I tried to follow this answer : wkhtmltopdf: cannot connect to X server but it still does not work.
This post helped me to resolve my problem :
http://www.stormconsultancy.co.uk/blog/development/generating-pdfs-in-rails-with-pdfkit-and-deploying-to-a-server/
I'm reproducing here the step from this post that helped me to install it :
# first, installing dependencies
sudo aptitude install openssl build-essential xorg libssl-dev
# for 64bits OS
wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2
tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2
mv wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf
chmod +x /usr/local/bin/wkhtmltopdf
He also create an initializer to tell to pdfKit where it is, so this method is for wicked PDF and PDF Kit.
Resolved this problem in this tread https://stackoverflow.com/a/34947479/5320149
I found method to resolve this problem without fake X server.
In newest version of wkhtmltopdf dont need X server for work, but it no into official linux repositories.
Solution for Ubuntu 14.04.4 LTS (trusty) i386
$ sudo apt-get install xfonts-75dpi
$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-i386.deb
$ sudo dpkg -i wkhtmltox-0.12.2.1_linux-trusty-i386.deb
$ wkhtmltopdf http://www.google.com test.pdf
Solution for Ubuntu 14.04.4 LTS (trusty) amd64
$ sudo apt-get install xfonts-75dpi
$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
$ sudo dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
$ wkhtmltopdf http://www.google.com test.pdf
Verify you have xvfb installed, or install it using apt-get
install xvfb.
Create a file called wkhtmltopdf.sh and add the following:
xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf $*
Change the dimensions (640x480x16) to match whatever virtual screen parameters you want it to emulate.
Move the shell script to /usr/bin, and set permissions:
sudo chmod a+x /usr/bin/wkhtmltopdf.sh
Optionally, you can add a symbolic link in your project directory:
ln -s /usr/bin/wkhtmltopdf.sh wkhtmltopdf
See this and this for reference.