I try to build a simple ruby script that checks the balance on the Kraken crypto exchange using the custom jonatack/kraken_ruby_client gem from github which is not available on ruby gems.
AWS Lambda throws the following error:
"errorMessage": "https://github.com/jonatack/kraken_ruby_client.git (at master#cda6c28) is not yet checked out. Run `bundle install` first.",
"errorType": "Init<Bundler::GitError>",
"stackTrace": ["/var/runtime/gems/bundler-2.1.4/lib/bundler/source/git.rb:204:in `rescue in load_spec_files'",
...
What I'm doing:
1. Gemfile
I've added the gem to the Gemfile as usual:
gem 'kraken_ruby_client', git: 'https://github.com/jonatack/kraken_ruby_client.git'
Everything works perfectly on my local machine.
2. Custom Dockerfile
Since the gem requires curb I created a Dockerfile, based on the AWS Lambda image for Ruby 2.7, to install libcurl:
FROM lambci/lambda:build-ruby2.7
RUN yum install -y curl-devel
RUN gem install curb
3. Deployment
I then "deploy" the script:
docker run -v `pwd`:`pwd` -w `pwd` -i -t kraken-app:latest bundle install --deployment
zip build.zip * -r -x .git/\* \*.sh specs/\* tests/\* \*.zip config/application.yml
aws lambda update-function-code --function-name kraken-app --zip-file fileb://build.zip --region=eu-west-1 --publish --profile XXXX
And it fails with the above error.
What I've tried with multiple StackOverflow answers:
1. Do what the error says - bundle install
I "bundle installed" and "bundled" as much as I could
2. Paths
All gems from Rubygems are installed into vendor/bundle/ruby/2.7.0/gems/, while the gem from github is installed into /vendor/bundle/ruby/2.7.0/bundler/gems/
So I've tried to add the path to $LOADPATH:
load_paths = Dir["./vendor/bundle/ruby/2.7.0/bundler/gems/**/lib"]
$LOAD_PATH.unshift(*load_paths)
As that didn't help, I even manually moved the folder from /bundler/gems to /gems before deploy, but no avail.
3. Local install in Docker image
I amended the Dockerfile to install the gem "locally" in the image by adding:
RUN gem install specific_install
RUN gem specific_install https://github.com/jonatack/kraken_ruby_client.git
I can run the script just fine in Docker in bash:
docker run -it --rm -v "$PWD":/var/task kraken-app:latest bash
Everything works in the Docker container on my local machine but it doesn't work when deployed to Lambda for some reason? Other Lambda functions work perfectly, I just can't get this custom gem to work...
Do you have any idea what else to try?
Thanks in advance!
"The file '/usr/local/bin/fastlane' specified the interpreter '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby', which is not an executable command."
Managed to fix it by:
1.) sudo gem install fastlane -NV
After this, try running your fastlane commands. In my case they didn't work but the output did suggest to run the next commands:
2.) sudo gem install bundler:2.0.2
3.) bundle update --bundler
And now I'm running it using:
bundle exec fastlane your_lane
(instead of fastlane your_lane)
I am trying to install fastlane. I have Xcode installed. I installed fastlane using the command sudo gem install fastlane. I now go into my project folder and type fastlane init and get the error:
-bash: fastlane: command not found.
I see that fastlane is installed and can see it here
/Users/username/.gem/ruby/2.0.0/gems/fastlane-1.70.0/bin
on my Mac.
I tried adding this to my PATH, but I still get the same error. My path is
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:./Users/username/.gem/ruby/2.0.0/gems/
What am I missing here?
Add the following line to your bash profile:
export PATH="$HOME/.fastlane/bin:$PATH"
You can either close the terminal session and restart it or run source ~/.bash_profile to load your configuration and then you can go so you start using fastlane 🚀
I got run into similar issue last week. I installed fastlane using homebrew on mac, but it was showing the same error.
I tried installing it using Ruby and it worked like a charm. Here is the command.
sudo gem install fastlane -NV
Also seems like you have not installed command line tools for xcode.
Install them using xcode-select --install
I met this issue because of installing zsh, the below two steps solve my problem:
open ~/.zshrc
save path
2.1 if you install fastlane with Homebrew
Copy export PATH="$HOME/.fastlane/bin:$PATH" on the bottom line.
2.2 if you install fastlane with RubyGems
Copy export PATH="/usr/local/bin/fastlane"" on the bottom line.
save upon file and try fastlane init, everything is OK!
In the terminal type cd ~/ to go to your home folder
Type touch .bash_profile to create your new empty file
Type open -e .bash_profile to open the file
Enter export PATH="$HOME/.fastlane/bin:$PATH" and save
Restart terminal (not sure needed?)
Here is what I installed on Mac - from scratch
Removed from brew install
brew uninstall fastlane
brew install rbenv
Install Ruby version 2.6.6
rbenv install 2.6.6
Set the Ruby version in global
rbenv global 2.6.6
Add Ruby to the PATH
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
Install bundler
gem install bundler
Install fastlane
bundle add fastlane
fastlane is in cask now. You can install it using
brew cask install fastlane
Now you need to export PATH so that your shell can find fastlane
do
export PATH="$HOME/.fastlane/bin:$PATH"
If that doesn't work, try this
export PATH="$HOME/.fastlane/bin/fastlane_lib:$PATH"
Make sure you add it to ~/.profile, ~/.zshrc or ~/.bashrc for future
If you are working on local machine then add following to you .bash_profile
export PATH="$HOME/.fastlane/bin:$PATH"
If you are working on Jenkins then this worked for me 😎
Under Jenkins -> Manage Jenkins -> Configure System -> Global properties -> Environment variables I added:
Name: Path
Value: /bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Reference
brew install ruby
brew install fastlane
Warning: fastlane 2.145.0 is already installed, it's just not linked
You can use brew link fastlane to link this version.
brew link fastlane
cd iOS
fastlane init
I have got the same issue on mac 10.11, after a lot of struggling I found that the problem in installing unf_ext 0.0.7.2 gem
I have done the following from this answer
brew install coreutils
After that try reinstall fastlane again it should work again
I faced this issue in Fedora 30 i followed these steps:-
1-installed all dev tools using these commands
sudo dnf install #development-tools
sudo dnf install #rpm-development-tools
2- run sudo gem install fastlane -NV
Fastlane worked like a charm
hope it helped
I managed to install following way
Install ruby
sudo apt install ruby ruby-dev
Add following to top of your "~/.profile" file
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Check of any errors with source ~/.profile command. If there is not output means all is good.
Install Build essentials
sudo apt-get update
sudo apt-get install build-essential
Fastlane depends on Google API Clint lets install that first
sudo gem install google-api-client
Install Fastlane
sudo gem install fastlane -NV
Check your installation
fastlane -v
Credits: This and this article helped me.
Flutter and Github Actions for Android:
If you are setting up Github Actions for a Flutter project for android and run into this error in one of your steps, see the work flow below:
jobs:
release:
runs-on: ubuntu-latest
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
steps:
- uses: actions/checkout#v3
- name: Set up ruby
uses: ruby/setup-ruby#v1
- name: Setup Fastlane
working-directory: ./android # <-- Make sure you have this
run: bundle install
- name: Run Fastlane
working-directory: ./android. # <-- Make sure you have this
run: bundle exec fastlane android [lane name].
Make sure to setup the ruby/setup-ruby#v1 action correctly depending on your project. see the doc: https://github.com/ruby/setup-ruby
In my case I have not specified the ruby version because I am using the .ruby-version file in my project.
DO NOT INSTALL FASTLANE GLOBALLY
It is recommended that you use a Gemfile to define your dependency on Fastlane. This will clearly define the used Fastlane version, and its dependencies, and will also speed up using Fastlane.
Step 1: Install bundler using
sudo gem install bundler
so any time you wan run Fastlane
bundler exec fastlane ...
You can add fastlane path environment by add line
export PATH="$HOME/.fastlane/bin:$PATH"
to ~/.bash_profile or ~/.zsh_profile file (if you use zsh shell).
And final start new terminal session or reload using command source ~/.bash_profile or source ~/.zsh_profile (if you use zsh shell)
First,You need to check if you have the ~/.fastlane file. If you don't have the file, you can execute brew cask install fastlane command. If you already have it. Check other answers.
Get the full path of the fastlane executable from the command line:
which fastlane
Add it to the shell profile, restart shell.
my question is straight, Please give me answers with some details of the tools that I use. I have done some research and I am not getting a straight solution.
I am trying to run a rails application that is using rails version 4.0.4 and ruby version 2.1.1. How can I set up the environment in my windows laptop?
Maybe you should create an Ubuntu Virtual Machine using Vagrant to run your rails app.
First of all, download VirtualBox and Vagrant.
Then change to a directory where you’ll build your project C:\projects\starting_rails for example and from that directory run:
$ vagrant init hashicorp/precise32
$ vagrant up
$ vagrant ssh
Those commands will create an Ubuntu virtual machine, set it up and then you will be able to login through ssh.
Inside the vm, you'll need to config everthing in order to run you rails app.
Install the PostgreSQL
# set that default locale before install postgres
$ sudo /usr/sbin/update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
$ sudo apt-get install postgresql libpq-dev
Once installed, create the database instance. Within the SSH session
$ sudo mkdir -p /usr/local/pgsql/data
$ sudo chown postgres:postgres /usr/local/pgsql/data
$ sudo su postgres
$ /usr/lib/postgresql/9.1/bin/initdb -D /usr/local/pgsql/data
$ createuser vagrant
Respond "Y" to Shall the new role be a superuser? Then you can 'exit' the su subshell.
Add privilege for vagrant to create db.
$ psql postgres psql
$ ALTER ROLE vagrant CREATEDB;
# exit with \q
$ \q
Then it is time to install RVM a ruby version manager.
$ sudo apt-get install curl
$ \curl -sSL https://get.rvm.io | bash
# installs all the various compilers and packages you’ll need to build Ruby and common libraries
$ rvm requirements
# installs ruby
$ rvm install 2.1.1
# creates a gemset rails
$ rvm gemset create rails404
$ rvm 2.1.1#rails404
# installs the rails
$ gem install rails -v 4.0.4
# sets 2.1.1 as default ruby version
$ rvm use 2.1.1 --default
After that, install bundler.
$ gem install bundler
And last but not least install nodejs.
$ sudo apt-get install nodejs
Vagrant shares the content of your desktop folder with your vm, so you can use your desktop favorite editor, your desktop git tool and test it on your desktop browser (but you need to configure port forwarding first).
You can find more details in this tutorial.
I hope it helps.
I have a big problem with my Debian server configuration. Someone before me has made a big mess with ruby installation and now i can't manage to get it all working. What i'm trying to do now is to get back to environment, where ruby1.8 is installed and rails app is working correctly with apache+passenger. If it would be working on RVM it would be perfect. Here is the story:
There was ruby 1.8 installed on a server. The person has removed it with sudo apt-get remove ruby1.8 and then installed version 2.0.x manually using those commands:
mkdir /tmp/ruby && cd /tmp/ruby
curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | tar xz
cd ruby-2.0.0-p247
./configure
make
sudo make install
Then, he has removed all the dirs listed by whereis ruby with rm command.
And here i came - i want to install RVM on this server. The problem is, no matter what i do, i get a lot of errors from all sides. Steps i've done:
# Install RVM
curl -L https://get.rvm.io | bash -s stable
# install 1.8.7 version
rvm install 1.8.7
# use 1.8.7
rvm use 1.8.7
# Install gems
bundle install
First thing (and that's just a tip of iceberg) is that i'm not able to start apache2 in cause of the following error:
apache2: Syntax error on line 203 of /etc/apache2/apache2.conf: Syntax
error on line 1 of /etc/apache2/mods-enabled/passenger.load: Cannot
load
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.5/libout/apache2/mod_passenger.so
into server:
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.5/libout/apache2/mod_passenger.so:
cannot open shared object file: No such file or directory Action
'configtest' failed.
Looks like there is even no /usr/lib/ruby/ dir on my system right now.
The question is: is there any way to reset all ruby-releated libraries on debian to the original state (debian without ruby installed) and install working RVM on top of that? Thanks in advance for any help.
Verify if, Is ruby installed correct by ruby -v
Install phusion passenger
$ sudo gem install passenger
$ sudo passenger-install-apache2-module
and then follow onscreen instructions