I am a beginner trying to learn and do the Ruby on Rails tutorials (http://guides.rubyonrails.org/getting_started.html#installing-rails)
and for all the bin commands in the command window such as
$ bin/rails --version
or
$ bin/rails server
I am getting the error " 'bin' is not recognized as an internal or external command, operable program or batch file.'
I just installed the latest version of Ruby so I've tried running
rake rails:update:bin
and I also added the PATH variable C:\RailsInstaller\Ruby1.9.3\bin to my environment variables.
I'm still getting the same error.
Thank you in advance!
You are getting those errors because you are on Windows. In this case you have to pass the scripts under the bin folder directly to the Ruby interpreter like this:
ruby bin\rails server
If you have added the bin directory to your PATH variable, then you don't need to use it in the command. Just type $ rails --version, etc.
Related
I am getting an odd error when trying to install TailwindCss into my Rails 7 Ruby 3.1.2 app. I do not understand how to correct this so it compiles / installs properly, any assistance here would be greatly appreciated. Error message below:
Add Tailwindcss include tags and container element in application layout
File unchanged! The supplied flag value not found! app/views/layouts/application.html.erb
Build into app/assets/builds
exist app/assets/builds
identical app/assets/builds/.keep
File unchanged! The supplied flag value not found! app/assets/config/manifest.js
File unchanged! The supplied flag value not found! .gitignore
File unchanged! The supplied flag value not found! Procfile.dev
Add bin/dev to start foreman
identical bin/dev
Compile initial Tailwind build
run rails tailwindcss:build from "."
["/home/starfixx/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/tailwindcss-rails-2.0.16-x86_64-linux/exe/x86_64-linux/tailwindcss", "-i", "/mnt/c/code/telipaxx/app/assets/stylesheets/application.tailwind.css", "-o", "/mnt/c/code/telipaxx/app/assets/builds/tailwind.css", "-c", "/mnt/c/code/telipaxx/config/tailwind.config.js", "--minify"]
/home/starfixx/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/tailwindcss-rails-2.0.16-x86_64-linux/exe/x86_64-linux/tailwindcss: 1: ELF: not found
/home/starfixx/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/tailwindcss-rails-2.0.16-x86_64-linux/exe/x86_64-linux/tailwindcss: 4: Syntax error: word unexpected (expecting ")")
rails aborted!
Command failed with exit 2: /home/starfixx/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/tailwindcss-rails-2.0.16-x86_64-linux/exe/x86_64-linux/tailwindcss
Tasks: TOP => tailwindcss:build
(See full trace by running task with --trace)
Thanks in advance for all your suggestions / assistance.
I am also using Windows 10 and the fix for me was to change my WSL version from 1 to 2 using Windows PowerShell:
wsl --set-version <distro name> 2
You can find your distro name and version by running in Windows PowerShell:
wsl -l -v
For details please visit Microsoft guide: https://learn.microsoft.com/en-us/windows/wsl/install.
PostgreSQL problem: If you are running PostgreSQL on windows you will face an error during connection, you must setup host in database.yml using this guide: WSL2 use "localhost" to access Windows service , and setup route using this: WSL2 and PostgreSQL connection.
You can check out the Tailwind CSS and Rails docs by visiting this page.
https://tailwindcss.com/docs/guides/ruby-on-rails
Follow this steps:
Install the gem.
gem "tailwindcss-rails", "~> 2.0"
Run bundle install.
Run rails tailwindcss:install
This will generate some files where you can add some tailwindcss colors, CSS file, etc, (config/tailwind.config.js)
After that, you have to run rails tailwindcss:build
This compile your tailwindcss configuration.
Add some test code.
Finally, run rails assets:precompile.
This command will compile all your JS and CSS of your JS.
Enjoy!
I am new to ruby on rail i have installed ruby on my system globally ruby -v command is working fine on my CMD but when i run it from other command prompt it give me not found error now i tried running it on my visual Code terminal and it is saying
"rails : The term 'rails' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again."
i need help with this please anyone
On a new ruby on rails project run this to install your dependencies
gem install bundler
bundle install
I am new to rails and am following the tutorial posted on the ROR website. Everything is working fine until I try and load up my rails application on the localhost. Every time enter $ rails server I get a long list of possible commands and functions. When I check my localhost:3000 and 127.0.0.1:3000, nothing seems to be connected.
Upon digging deeper, I have tried almost everything everyone else has tried. I am running the command in the same path as my new rails application. Furthermore, when I enter in nonsense after the $ rails command I get the same list of possible commands and functions. So I get the feeling that rails is not recognizing the server command.
Here are my versions:
Ruby 1.9.3 p374
Rails 3.2.11
Why isn't the server command recognized?
First of all you have to move to the project directory and install bundle with the following command:
bundle install
Then start the server:
rails server
I had the same problem. rails server or simply rails s only works when you are in the right directory.
Type pwd (present working directory) to see where you currently are.
Type cd and the rest of the direction to the correct directory.
(for example, "cd workspace/learn-rails")
Type rails server or rails s.
Check http://localhost:3000.
Please exit from terminal and then restart the terminal.
Then check the directory path i.e just type pwd it will show the current directory path.
And if directory is correct on try again running command like bundle install & rails server
I think this should be work.
For my Ruby on Rails project I have to do a lot of stuff in the command line, like running rake tasks or running test specs. In my app I need to supply an environment variable to do this, e.g. ENCRYPTION_PASSWORD=bla rake db:test:prepare
What is a good way to add environment variables to RVM, so I don't have to use the variable every single time in the command line? Thanks!
In your applications folder you can place a .rvmrc file with the settings you need for your project. This file is read, when you change to this directory. E.g, I have a .rvmrc with this content:
rvm use ruby-1.9.2-p320
couchdb -b
When I enter the applications folder, rvm is firing a hook with parsing the file contents:
cd project/
Using /Users/andwen/.rvm/gems/ruby-1.9.2-p320
Running /Users/andwen/.rvm/hooks/after_use
Apache CouchDB is running as process 39539, time to relax.
Running /Users/andwen/.rvm/hooks/after_cd
I am trying to get Ruby on Rails going on my Windows 7 machine. I am using gitbash and have install ruby using ruby installer. All my gems have installed successfully (Rails 3.0.7), but when I try to run a command like rails s I get sh.exe": rails: command not found
echo $PATH gives me:
/c/Users/Dave/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Ruby192/bin:/c/Program Files/Common Files/Microsoft Shared/Windows Live:/c/Program Files/NVIDIA Corporation/PhysX/Common:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/Program Files/Common Files/Adobe/AGL:/c/Program Files/QuickTime/QTSystem/:/c/Program Files/Common Files/Microsoft Shared/Windows Live
Since the path for Ruby is in there I am at a bit of a loss for how to be able to start the rails server.
running gem install rails fixed it
This Problem confuses basic developers. Because they simultaneously use both Git Bash & Command Prompt with Ruby and Rails.
When we type "Rails any command" in CMD with Ruby and Rails, we don't see any failure. But if we run the same command in gitbash means, we get the result "Command not found". Running "Gem install rails" fixs it for gitbash users as the above sayings.
For those who use both Git and Cmd with ROR, they can get the command executed anyhow by running on any of the one...