I do everything according to Readme but having an issue when starting a rails app: Sprockets::FileNotFound And it points to //= require twitter/bootstrap Does this gem really install bootstrap stylesheets and corresponding js libraries or one is supposed to install them manually (with bower or in another way)?
Here is my Gemfile:
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :assets do
gem 'twitter-bootstrap-rails'
end
gem 'responders', '~> 2.1.1'
gem 'haml'
group :development, :test do
gem 'pry-byebug'
gem 'pry-rails'
gem 'rspec-expectations', '~> 3.0.0'
gem 'spring-commands-rspec'
#gem 'guard-rspec', require: false
gem 'rspec-rails', '~> 3.0.0'
# Support for its syntax
gem 'rspec-its', '~> 1.0.1'
gem 'shoulda-matchers', '~> 3.1.1'
gem 'factory_girl_rails'
gem 'ffaker'
gem "bower-rails", "~> 0.10.0"
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'haml-rails'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
I'd say that because group assets were dropped in Rails 4. From the docs:
Rails 4.0 removed the assets group from Gemfile. You'd need to remove that line from your Gemfile when upgrading. You should also update your application file (in config/application.rb):
So instead of using it
....
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :assets do
gem 'twitter-bootstrap-rails'
end
....
Just remove the group block:
....
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'twitter-bootstrap-rails'
....
And then run bundle install and restart the server.
More info - Why did Rails4 drop support for “assets” group in the Gemfile
Related
I'm attempting to run a rails app on my local machine developed elsewhere, but I can't get it to run locally. When I run rails s to get the server running, I get:
Could not find proper version of railties (4.2.6) in any of the sources
Run `bundle install` to install missing gems.
So, naturally, I run bundle install but get the error:
Attempting to write to
`/home/rails/apps/intranet/shared/bundle/ruby/2.2.0` is
unsupported by your OS
My OS is macOS Sierra version 10.12.4.
Also, railties is in the gem folder and seems to be the correct version.
Thanks in advance.
Edit: Adding Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'devise'
gem 'rails_admin'
gem 'carrierwave'
gem 'where-or'
# Railties
gem 'railties', '~> 4.2', '>= 4.2.6'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'pry-rails'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'guard', require: false
gem 'guard-rspec', require: false
gem 'guard-bundler', require: false
gem "guard-cucumber", require: false
gem 'ruby_gntp'
gem 'terminal-notifier'
gem 'terminal-notifier-guard'
gem 'thin'
gem 'quiet_assets'
gem 'capistrano-rails'
gem 'capistrano-rvm'
gem 'capistrano3-unicorn'
gem 'capistrano-bundler'
gem 'better_errors'
gem 'binding_of_caller'
end
group :test do
gem 'database_cleaner'
gem 'capybara'
gem 'shoulda-matchers'
gem 'poltergeist'
gem 'launchy'
gem "cucumber-rails", require: false
end
Found out what was the issue. Since this was downloaded from a remote server, the .bundle/config file had a different path for 'BUNDLE_PATH'. I simply had to change that to the path on my own computer instead of the path on the remote server and I stopped getting the error.
check if you have write permissions to the directory /home/rails/apps/intranet/shared/bundle/ruby/2.2.0`
I am currently using Rails 4.2.5 for my project. In my gemfile, the way I install is :
gem 'awesome_nested_set'
Even though I install successfully, the problem is happened in the server.
Error:
undefined local variable or method `acts_as_nested_set'
only at production environment.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'mysql2', '0.3.18'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
#gem 'turbolinks'
gem 'awesome_nested_set', '3.0.2'
gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'bcrypt', '~> 3.1.7'
gem 'devise'
gem 'rails_admin'
gem 'rb-readline'
gem 'unicorn'
gem 'capistrano', '>= 3'
gem 'capistrano-bundler'
gem 'capistrano-rbenv', github: "capistrano/rbenv"
gem 'capistrano-rails'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-oauth2', '~> 1.3.1'
# Use Unicorn as the app server
# gem 'unicorn'
gem 'wicked'
gem 'kaminari'
gem "simple_calendar", "~> 2.0"
gem 'bootstrap-sass'
gem 'chosen-rails'
gem 'mailboxer'
gem 'webpay'
gem 'unicorn'
gem 'gretel'
gem 'sitemap_generator'
gem 'stripe'
gem 'carrierwave'
gem 'rmagick'
gem 'i18n_generators'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'pry-rails'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
# gem 'spring'
end
[]# bundle show 'awesome_nested_set'
/usr/local/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/awesome_nested_set-3.1.1
It's in there..!
This is my first project in Rails 4, I'm using 4.2
I'm finding that rspec is not reloading my spec files each time it runs, so tests that I've fixed continue to fail with the old error message.
I'm guessing this has something to do with spring but I can't seem to find information on how to configure paths it should reload.
I'm launching rspec using bin/rspec, and here's my Gemfile if that's of use.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Angular CSRF handling
gem 'angular_rails_csrf'
gem 'pg'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
#gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
gem 'sass', '3.2.19'
group :test, :development do
gem "factory_girl_rails", "~> 4.0"
gem "capybara"
gem "database_cleaner"
gem "selenium-webdriver"
gem "teaspoon-jasmine"
gem 'teaspoon'
gem 'phantomjs'
gem 'guard-teaspoon'
gem 'spring-commands-teaspoon'
gem 'rspec-rails'
gem 'spring-commands-rspec'
gem 'guard-rspec'
gem 'rb-readline'
gem 'rb-fsevent' if `uname` =~ /Darwin/
end
gem 'bootstrap-sass', '~> 3.1.1'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bson_ext', '~> 1.8.6'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', '1.3.6'
end
# Preload angular templates
gem 'angular-rails-templates'
Okay, so I've got an error while building my Docker image (think of it as similar to a deploy step, or Heroku deploy if you're unfamiliar with Docker).
Gems that are in the :test and :development groups are being looked for when the precompile step happens, and since I've bundled --without development test - as I don't want to have QT just so that capybara-webkit doesn't error on bundle - the precompile step is throwing an error.
The error is always a variant of:
Could not find <gem-name> in any of the sources (Bundler::GemNotFound)
My Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.9'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
gem 'unicorn', '~> 4.8.3'
gem 'unicorn-worker-killer', '~> 0.4.2'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'rdf', '~> 1.1.0'
gem 'tripod', '~> 0.11.1'
gem 'devise'
gem 'devise_invitable'
gem 'authority'
gem 'mongoid', '~> 4.0.0'
gem 'bootstrap-sass', '~> 3.3.3'
# pagination
gem 'kaminari', '~> 0.16.3'
gem 'bootstrap-kaminari-views'
# background processing
gem 'sidekiq'
gem 'sidekiq-status'
gem 'request_store', '~> 1.1.0'
# add memoization
gem 'memoist', '~> 0.12.0'
# dropbox gem for uploads etc
gem 'dropbox-sdk', '~> 1.6.4'
# error reporting
gem 'sentry-raven'
group :development, :test do
gem "rspec-rails", "~> 3.0.0"
gem "factory_girl_rails", "~> 4.5.0"
gem "capybara", "~> 2.4"
gem "database_cleaner"
# gem "selenium-webdriver"
gem 'poltergeist'
gem 'capybara-webkit'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
#gem 'byebug'
gem 'pry-byebug'
gem 'better_errors', '~> 2.1.1'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
# gem 'spring'
end
The line in the Dockerfile where the error happens is:
RUN /bin/bash -l -c "RAILS_ENV=production bundle exec rake assets:precompile RAILS_GROUPS=assets --trace"
So basically, what I'm really after is the equivalent for --without test development for the rake task. Can I do that? As per some advice, I've already changed (in application.rb):
Bundler.require(*Rails.groups)
to
Bundler.require(:default, :assets, Rails.env)
Anybody have Rails-fu enough to solve this one? I've looked in the docs and on SO, as well as asking my colleagues but I'm still banging my head against the wall over this.
bundle install --path vendor/cache
Try this and let me know if it doesn't work!
I have a rails app that I am trying to install devise on.
I use the command
rails generate devise:install
but it fails, giving this message:
Could not find generator 'devise:install'. Maybe you meant 'ckeditor:install', 'assets' or 'comment'
however if I use sudo rails generate devise:install it works.
I do not want to generate devise:install as root however.
I have done chmod a+x on the directory.
I also recently changed macbooks and imported my ssh key from the previous macbook, but I added the key with ssh-add. Not sure if this is the problem.
this is my gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
gem 'thin'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'devise', '3.5.3'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'bootstrap_form'
gem 'kaminari'
gem 'carrierwave'
gem "rmagick", :require => 'RMagick'
gem 'ckeditor'
gem 'acts_as_commentable'
gem 'addressable'
gem 'vimeo'
gem 'underscore-rails'
gem 'gmaps4rails'
gem 'geocoder'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'pry'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'rails_12factor', group: :production
I managed to solve this by deleting my Gemfile.lock, doing bundle install again and then stopping spring with spring stop I could then call the generator without root privileges
It's kind of weird, but I solve the problem restarting my mac