There was an error while trying to write to C:/Users/REMOTE~1/AppData/ on Bundle Install [Rails 5.1.3, Ruby 2.3.3]
After 3 days of tinkering and trying to find a solution I came up with the following.
1.) As @anothermh mentioned, it is probably best to install Ruby on Windows Subsystem for Linux Installing Ruby on WSL (Windows Subsystem for Linux) to avoid these kind of situations.
2.) For people who still want to continue using Ruby on their windows systems.
This error occurs when your bundler rubygems copy is corrupted and gets cached into your system.
I solved this by deleted the folder .bundle in C:/users/my_user/.bundle
Re-install bundler and this error goes away and your gems compile and install as usual.
How to change versions of Ruby 1.9 to Ruby 2.0 in the new Windows 10 Bash shell?
Currently, WSL is based on Ubuntu 14.04, so there are no recent Ruby versions available with the official apt repos.
You can install Ruby 2.1, 2.2 and 2.3 via Brightbox/ruby-ng ppa repository if you prefer managing packages with apt.
Quoting from the Brightbox site:
$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:brightbox/ruby-ng
$ sudo apt-get update
And then,
sudo apt-get install ruby2.1
Otherwise, rbenv is an another option to achieve that.
How to install ruby 2.4.0 in Windows 10
Windows 10 comes with a new feature called Windows Subsystem for Linux (WSL) that allows you to use Bash with the most common Linux tools included the ones you need to install a Ruby Manager Version.
For this tutorial we'll set up Ubuntu on Windows, Ruby 2.4.0, Rails 5.0.1 and PostgreSQL.
Installing Bash On Windows
First enable developer mode on your machine
https://www.youtube.com/watch?v=S6NvjvL3xaINext install Windows Subsystem for Linux
https://www.youtube.com/watch?v=g_5hxfFKDL8And restart your computer.
After the computer reboot open a Command Prompt (CMD) and type
> bash
You will see the next message
This will install Ubuntu on Windows, distributed by Canonical
and licensed under its terms available here:
https://aka.ms/uowterms
Press "y" to continue: yPress "Y" to continue
Downloading from the Windows Store... 100%
Extracting filesystem, this will take a few minutes….Bash will ask you for a user, please remember this user because bash will ask you every time you need root permissions in Bash. Also when you time your password you won’t see the keystrokes, it’s normal, only keep typing and press ENTER when you finish.
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms.wslusers
Enter new UNIX username:
Enter new UNIX password:And your Bash is ready when you see the CMD its in the
mnt/c/Users/your_username
directory.your_username@yourmachine:/mnt/c/Users/your_username$
Installing RVM and Ruby
In your bash copy this line:
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Then install gnup2
$ sudo apt-get install gnupg2
Remember your UNIX password because every time you saw a
sudo
in the command you will be asked for your password.
Install RVM
$ \curl -sSL https://get.rvm.io -o rvm.sh$ cat rvm.sh | bash -s stable
$ source ~/.rvm/scripts/rvmInstall Ruby
$ rvm install ruby-2.4.0
If you need to install other version of ruby run this same command like this
$ rvm install ruby-2.3.5
And select the ruby version you want to use
$ rvm --default use 2.3.5
To check if it works
$ ruby -v
Installing RubyOnRails
Install the Ruby’s package manager Bundler
$ gem install bundler
Add NodeJS
$ curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
$ sudo apt-get install -y nodejsInstall Rails
$ gem install rails
Installing PostgreSQL
Download PostgreSQL installer and follow the instructions of the installation
https://www.openscg.com/bigsql/postgresql/installers.jsp/The installer will ask you for a user and a password, also keep them in a safe place because you will use it to access to PostgreSQL command line and in
database.yml
in your ROR project.When the installation finish, return to bash and type the next command
$psql -p 5432 -h localhost -U your_postgresql_username
Bash will ask you the PostgreSQL password and if everything works you will have access to the Postgres shell prompt
psql (9.5.6, server 9.6.2)
WARNING: psql major version 9.5, server major version 9.6.
Some psql features might not work.
Type "help" for help.
postgres=#Type \q to exit the Postgres shell.
Running your Rails app
Open the project in your favorite editor and update the
database.yml
with the PostgreSQL username and password.development:
database: your_app_name_development
username: your_postgres_user
password: your_postgres_password
host: localhost
port: 5432
test:
database: your_app_name_test
username: your_postgres_user
password: your_postgres_password
host: localhost
port: 5432In Bash go to the directory where is your rails project, for example:
$ cd Projects/my_app
To learn more about Bash navigation visit
https://www.pluralsight.com/guides/beginner-linux-navigation-manual
Create your database
$ rake db:create
Run the rails server to make sure everything is working
$ rails s
And go to your browser and visit
$ localhost:3000
Every time you need a Bash, open a Command Prompt and type
>bash -l
For more detail of each of the commands in this tutorial, visit
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-and-set-up-a-local-programming-environment-on-windows-10
https://medium.com/@colinrubbert/installing-ruby-on-rails-in-windows-10-w-bash-postgresql-e48e55954fbf
Running rails server on bash a linux system on windows
Don't have enough reputation to post as comment but this should provide some answers: https://github.com/rails/rails/issues/26054
Seems to be a windows related issue from last month.
Haven't used ruby on rails in quite a while so I can't reproduce or test (right now) to see if this is true.
From a comment wich was helpful to others:
Go to you config/environments/development.rb and comment out the last
line, something about watching files and listen gem. can't remember
from the top of my head the exact wording, but it is the last line of
configthis is new a new method that rails uses to watch changed files, but
it doesn't work on WSLI think guard gem will also fail because of this
Bottom line:
Using rails new --skip-spring --skip-listen gives you a working app
Related Topics
Pg Error Could Not Connect to Server: Connection Refused Is the Server Running on Port 5432
Are Ruby 1.9 Regular Expressions Equally Powerful to a Context Free Grammar
"Errno::Eaccess...Permission Denied" Running Compass Watch
Simple Ruby Input Validation Library
Sinatra Static Assets Are Not Found When Using Rackup
I Can't Install Rmagick Gem on Windows
Mongoid: Find Through Array of Ids
How to Tell Rubocop to Ignore a Specific Directory or File
Convert String with Comma to Integer
How to Use Basic Authentication with Httparty in a Rails App
How to Organize Minitest/Unit Tests
Ruby: How to Group a Ruby Array
How to Update a Single Attribute Without Touching the Updated_At Attribute