I'm here on Windows 7 x64 and am trying to install Ruby on Rails from scratch. I just installed the RubyInstaller 1.9.3-p429 and now just ran the DevKit-tdm-32-4.5.2-20111229-1559-sfx. After doing ruby dk.rb install --force. I tried to test if it's setup correctly but run into:
c:\DevKit>gem install RedCloth --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
checking for main() in -lc... no
creating Makefile
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.9 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
And this happens to all gems that need the Devkit. I guess I have to set the path specified but I have no idea what that means. How do I do that or what's the real problem here?
P.S.
A little bit of background. I did have RailsInstaller installed but I was getting the same error so I deleted everything. I also had NodeJs installed as well but deleted that too. I erased the PATH variables completely to start from scratch.
UPDATE
Trying the RailsInstaller gives me this error:
$ gem install json -v 1.8.0
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.0 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
I hate to bump an old thread, but I wish to add to the answers just in case someone else comes by (likely as this is at the top of a Google search for a "Devkit PATH error").
After extracting the DevKit into a permanent directory and after you've navigated to the install folder within your shell and entered the "ruby dk.rb init" command, make sure you actually do the next step and install the devkit. After the init command, run "ruby dk.rb install" and that should fix many similar problems.
You need to include the Devkit/bin directory in your environment path. First, find out where Devkit was installed. For this example, we'll presume it's at C:\Devkit.
Next open your Advanced System Settings (accessible under MyComputer => Properties), and click the Environment Variables button. Under the 'user variables' section, edit the 'Path' entry to include C:\Devkit\bin. Note that this entry is semicolon delimited so you'll need to add a trailing (or prepending) semicolon to this string.
I was facing the excact same problem when I tried to install Cucumber until I tried using the --verbose parameter. For some reasons this worked out for me but I cannot really explain why. I am not considering it as a solution but it is worth a try.
The best that has worked for me always in these errors is: https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#wiki-gems_fails_comspec_autorun
If you installed the devkit as per standard guidelines on https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#installation-instructions, then it's not the Devkit path but the incorrect Autorun regex key OR the incorrect command processor set by other tools that interferes with ruby gem installations. Give it a go.
I had this issue, Windows 8 x64, Ruby 2.2.3.
I tried everything from many posts and many answers but only this worked for me: Deleting old devkits and installing again.
I got it working after these steps:
Delete every folder you have ever installed devkit
Install (x64 - 64bits only) DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe from http://rubyinstaller.org/downloads/
Execute and install somewhere without spaces or anything on the path (I did c:\devkit)
Go to your system environments and add to the path c:\devkit and c:\devkit\bin
Open a CMD prompt as an admin, go to c:\devkit and type:
ruby dk.rb init
ruby dk.rb install --force
https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#error-failed-to-build-gem-native-extension
That details a couple scenarios that can cause this problem. Just in case the link dies, though. The first is where your COMSPEC system variable no longer has a full path to cmd.exe. The second is where some kind of autorun is in the registry--this is where you check:
REG QUERY "HKCU\Software\Microsoft\Command Processor" /s
REG QUERY "HKLM\Software\Microsoft\Command Processor" /s
REG QUERY "HKCU\Software\Wow6432Node\Microsoft\Command Processor" /s
REG QUERY "HKLM\Software\Wow6432Node\Microsoft\Command Processor" /s
And if you see any autoruns you delete them with something like:
REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun
Related
i'm new with Ruby and i never used gem files. I had to install offline some gem files. Unfortunately i followed another procedure, instead of following the documentation so i wrote a script to go through the folder "gem" of my installation directory and run first "build" and then "install --force --local ". The "clean" way would have been running just this last command but in the "cache" folder of the installation directory.
I suspect this corrupted my gems. In fact, when running my software (based on this gems) i get this error:
/var/lib/gems/2.6.0/gems/rubyzip-1.3.0/lib/zip/central_directory.rb:143:in `get_e_o_c_d': Zip end of central directory signature not found (Zip::Error)
The only idea i've is to clean up and re-install the gems, but i know that bundle clean --force can not be used that easily, since it can destroy also other gems not related with this last installation.
Do you have any suggestions?
Thank you
I have a long standing Rails app that runs on Ubuntu on another cloud service, but I'm migrating it to AWS.
The Capistrano 3 deployment gets so far, but it fails installing gems that require native building, with the following error (this is one example).
I've pasted the full error at the bottom, but the root cause error appears to be the path used to invoke ruby,
sh: 1: //bin/ruby: not found
The same gem[s] install fine when installed locally on the AWS server.
I've investigated, and confirmed that the deployment via ssh is using a non-interactive shell, but I'm setting the ruby path using all three of .bashrc, /etc/environment and using,
set :default_env, { "PATH" => "$PATH:/snap/bin" }
...but still no joy.
I suspect there's a problem with the way the path to invoke ruby is being formed, as //bin/ruby (with that double forward slash) is syntactically incorrect for bash shell.
It's as if there's an environment variable that should be set and inserted between those slashes is defined as an empty string (or just not defined), but I've checked env vars for non-interactive shell against the interactive shell, and all looks the same in interactive and non-interactive shells.
I'm not using rvm, as I don't need to, and would rather not add that complexity unless it's absolutely needed (and I don't think it should be).
Any ideas on why ruby is being invoked with that invalid path?
Full error details, for context and reference,
An error occurred while installing mysql2 (0.3.21), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.21' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
mysql2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/home/rails/myrailsapp/deployonaws/shared/bundle/ruby/2.3.0/gems/therubyracer-0.12.3/ext/v8
//bin/ruby -r ./siteconf20190520-13147-dgcr4x.rb extconf.rb
sh: 1: //bin/ruby: not found
extconf failed, exit code 127
OK, I figured out what was going on.
After 34 years of using Unix, I learned that '//' is valid syntax for a path, so that was a red herring.
The issue really was that ruby executable wasn't in //usr/bin
I experimented with linking from the actual path that ruby was located, but this just hit other issues with ruby versions (that old chestnut).
The eventual 'fix' was to start again with a fresh Ubuntu instance, and install ruby using
sudo apt install ruby-full
...rather than...
sudo snap install ruby --classic --channel=2.3/stable
...that I had used previously.
Using the apt install put ruby under /usr/bin, and all was right with the world again.
Thanks.
I had Ruby-on-Rails installed, but it was Ruby version 1.9.3. It was installed via the Railsinstaller. Since I am just starting in RoR, I wanted to start with the most updated versions to go through the Ruby on Rails Tutorial. Rails was easy enough to update, but not Ruby itself.
I uninstalled the existing RailsInstaller, deleted the c:\Railsinstaller directory and downloaded the latest version of RailsInstaller, version 3.0.0-alpha.1.
Upon install it launches a command prompt window that should list the install infor for git, ruby and rails. Instead I got this error:
The system cannot find the path specified.
Rails Environment Configuration.
C:/RailsInstaller/scripts/config_check.rb:28:in ``': No such file or directory -
rails -v (Errno::ENOENT)
from C:/RailsInstaller/scripts/config_check.rb:28:in `run'
from C:/RailsInstaller/scripts/config_check.rb:83:in `<main>'
C:\Sites>
Line 28 is part of this block:
def run(command)
$stderr.puts "Running #{command}" if Config[:debug]
%x{#{command}}.chomp
end
and line 83 is this inside of a 'puts' block:
version: #{run "rails -v"}
manually running "rails -v"
C:\Sites>rails -v
'rails' is not recognized as an internal or external command,
operable program or batch file.
attempting "ruby rails.rb"
ruby: No such file or directory -- rails.rb (LoadError)
attempting to manually install the rails gem
c:\Sites>gem install rails --version 4.0.0
Fetching: i18n-0.6.4.gem (100%)
Successfully installed i18n-0.6.4
Fetching: atomic-1.1.10.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0
.0/gems/atomic-1.1.10 for inspection.
Results logged to C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.
1.10/ext/gem_make.out
The gem_make.out only contains:
C:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
creating Makefile
I attempted to install Railsinstaller 3.0.0 on a windows xp machine to test, and got the same error after the install, running "rails -v" failed in the same way, but running "gem install rails --version 4.0.0" worked.
Did something persist from the previous install that is preventing the new install from functioning properly?
I think something is still trying to go to the Ruby1.9.3 forlder and/or subfolders and failing, but can't find anything referencing that directory.
After a bunch of additional research and out side help, found this:
You’ve installed both RubyInstaller and DevKit following the instructions but during gem installation, you receive a message like this:
C:\devkit>gem install rdiscount --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rdiscount:
ERROR: Failed to build gem native extension.
C:/ruby/bin/ruby.exe extconf.rb
C:/ruby/bin/ruby.exe: No such file or directory -- extconf.rb
(LoadError)
Or sometimes just this:
ERROR: Error installing rdiscount:
ERROR: Failed to build gem native extension.
C:/Ruby187/bin/ruby.exe extconf.rb
This has been reported to our group here and here.
After a long back and forth investigation, we found two possible causes for this issue: COMSPEC environment variable (scenario A) and AutoRun registry setting (scenario B), both described below:
Scenario A
Using a command prompt, invoke the following command:
SET COMSPEC
If in the output you see something different than cmd.exe as value for that variable, then please adjust it to use cmd.exe
Some tools might change your command processor command, which interferes with Ruby invoking child processes.
Change that and try to install the gem again.
Scenario B
If the problem persist, invoke the following commands in the same command prompt:
REG QUERY "HKCU\Software\Microsoft\Command Processor"
REG QUERY "HKLM\Software\Microsoft\Command Processor" /s
Execute each line individually. Once you run it, will see something like this:
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
CompletionChar REG_DWORD 0x9
DefaultColor REG_DWORD 0x0
EnableExtensions REG_DWORD 0x1
PathCompletionChar REG_DWORD 0x9
The columns of information are Key, Type and Value. If you see a key named AutoRun, there is a chance this is the culprit of the error you’re receiving.
AutoRun interferes with Ruby messing with child process executing and by result, affecting gem installation. Please remove it with the following command:
REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun
Once you’re done, try opening a new command prompt and executing gem installation again.
Scenario B ended up being the culprit and things began working properly once that was completed.
I apologize that this doesn't actually answer your question at hand, but I think it's still useful advice to you:
Consider downloading Virtualbox and installing some Linux (Fedora, Ubuntu) on it and doing your Rails development on that Linux virtual machine. It won't mess with your Windows system at all, but it will be much easier to develop Rails with.
Almost nobody develops Rails on Windows, everyone uses Mac or Linux it seems. And I always read people having problems setting it up on Windows. It just doesn't seem worth the effort to me when you have free tools out there to develop on Linux.
Again, sorry this isn't actually the proper answer to the question. Even once you find the answer to your problem, I'd still recommend you consider this advice. You're likely to have more problems with Rails on Windows.
New to Ruby on Rails. Working in Windows XP.
I have installed the rails installer from railsinstaller dot org
Working through the example from guides dot rubyonrails dot org / getting_started
Issued the command 'rails new blog'
the bundle install fails on Network error while fetching https://rubygems.org/quick/Marshal.4.8/sqlite3-1.3.6.gemspec.rz
I have downloaded the sqlite3-1.3.6 gem and tried to manually install, receiving the following error:
checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
* extconf.rb failed *
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
I've read many different websites that tell me to make sure Sqlite3.dll is in the system path, so I've downloaded the latest Sqlite3.dll (from sqlite3 dot org, using the windows precompiled binaries) and placed them within the path, even overwriting the Sqlite3.dll file within c:\Railsinstall\Ruby1.9.3\bin but all to no avail. I've even tried registering Sqlite3.dll using regsrv32 Sqlite3.dll, only to receive the message "Sqlite3.dll was loaded, but the DllRegisterServer entry point was not found. This file can not be registered"
I have successfully been able to install Sqlite3-1.3.6-x86-mingw32.gem, however 'rails new blog' still looks for Sqlite-1.3.6
If I try 'rails new blog --skip-bundle', I can successfully create blog, but I think I'm just skirting the issue.
Anyone have any idea what I might be missing? I have the Sqlite3.dll within the path, but still can't get past the Sqlite3.h file not found error.
Thanks
(I know I may have a proxy issue, but I still should be able to install the gem file locally. I've been able to do that for every other requested gem file.)
Go to SQLite3 download page, “Precompiled Binaries For Windows” section
Download “sqlite-shell” and “sqlite-dll” archive files
Unpack them in C:\WINDOWS\system32 folder (or any other that is in your PATH)
Install the sqlite3 Ruby gem.
Having .dlls in system32 is MANDATORY
I really appreciate if one can provide some insight for installing ruby on rails 3.x framework to a computer without internet connection.
All the tutorials or explanations seem to assume that there is always an internet connection. Is there simple way to download a bundle with all the dependencies included and simply install the bundle.
Thanks in advance
Finally. The complete list of Gems that you need to download manually, in order to install Rails in Offline mode (or behind a proxy that prevents your "gem" commands from working).
This list assumes that you already have the following things (Windows 7):
Ruby 1.9.2
RubyGems 1.8.24
DevKit
THE LIST.
Go to rubygems.org and use the Search function to download each one of the following Gems. You don't need to type the complete name with version numbers and stuff. For example, just "actionmailer" will work and will find the latest version).
Each gem page shows you the command line you have to type when installing it normally in a computer that isn't behind a proxy. Ignore it and just click the download link.
actionmailer-3.2.6.gem
actionpack-3.2.6.gem
activerecord-3.2.6.gem
activeresource-3.2.6.gem
activesupport-3.2.6.gem
rake-0.9.2.2.gem
i18n-0.6.0.gem
multi_json-1.3.6.gem
activemodel-3.2.6.gem
arel-3.0.2.gem
tzinfo-0.3.33.gem
builder-3.0.0.gem
erubis-2.7.0.gem
journey-1.0.4.gem
rack-1.4.1.gem
rack-cache-1.2.gem
rack-test-0.6.1.gem
sprockets-2.1.3.gem
hike-1.2.1.gem
tilt-1.3.3.gem
mail-2.4.4.gem
mime-types-1.19.gem
treetop-1.4.10.gem
polyglot-0.3.3.gem
rails-3.2.6.gem
bundler-1.1.4.gem
railties-3.2.6.gem
rack-ssl-1.3.2.gem
rdoc-3.12.gem
thor-0.15.3.gem
JSON-1.7.3.gem
(31 files total)
Just keep in mind that the versions may change. I did this in June 2012 and those were the versions that worked for me.
Copy all those files to the Ruby installation dir.
Then, open a CMD console.
cd \
cd <RubyInstallDir>
gem install rails-3.2.6.gem
Installation should run normally.
It is possible that some dependencies need a different version.
In that case, the error message will show you the right version. So you just need to download the version from rubygems.org (there is a list of old versions in the gem's page) and run the gem install command again.
I hope this can help.
You can use bundler to achive that. Bundler accepts the path where you can specify the location for the gems to be installed. Run the following command where you have internet connection. It will download all the dependencies and pack them into the specified folder.
bundle install --path gems # 'gems' is the folder present in Rails.root
Now that all the dependencies are within the project, you can copy the project to the machine where you don't have internet connection. From now on use the commands like:
bundle exec rails server
bundle exec rails console
Note that you have to install the bundler gem manually in the target machine.
I know that this question refers to Rails 3, but I created PortableRails exactly because of this (which has recently been updated to support Rails 4). Just make sure that you run bundle --local instead of just bundle (which is what the new-action tries to perform).