So I have installed this twice now and still have the same error
I run mongod
I run unicorn
it tells me to create and account,
i create the account
log in
then Sass::SyntaxError in Locomotive/pages#index
Showing /Users/jorybraun/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/locomotive_cms-2.4.1/app/views/locomotive/shared/_head.html.haml where line #14 raised:
File to import not found or unreadable: compass/css3/transform-legacy.
Load paths:
Sass::Rails::Importer(/Users/jorybraun/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/locomotive_cms-2.4.1/app/assets/stylesheets/locomotive/backoffice/menu/main.css.scss)
/Users/jorybraun/sites/jancms/jancms/app/assets/stylesheets
/Users/jorybraun/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/compass-core-1.0.1/stylesheets
Compass::SpriteImporter
(in /Users/jorybraun/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/locomotive_cms-2.4.1/app/assets/stylesheets/locomotive/backoffice/menu/main.css.scss)
Extracted source (around line #14):
11: :plain
12: window.Locomotive = { mounted_on: '#{Locomotive.mounted_on}' }
13:
14: = stylesheet_link_tag 'locomotive', media: 'screen'
15: = javascript_include_tag 'locomotive'
16:
17: = render 'locomotive/shared/main_app_head_before_backbone'
Trace of template inclusion: /Users/jorybraun/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/locomotive_cms-2.4.1/app/views/locomotive/layouts/application.html.haml
any ideas ?
I had the same problem today. I solved it by adding the following line to my project's Gemfile:
gem 'compass', '~> 0.12.7'
Apparently there is some kind of bug in compass 1.0.1, and assets won't precompile. This line forces the version of compass to be 0.12.x, so add this in, run
bundle update
bundle install
... and you should be good to go.
Related
I tried many things but my navbar is not showing properly on browser, just because sccs is not loading. This application was a Rails API Application and I converted to regular application. Maybe something went wrong on this process.
Assets/Stylesheets/application.scss
// Your CSS partials
#import "components/index";
Assets/Stylesheets/Components/_index.scss
// Import your components CSS files here.
#import "navbar";
Assets/Stylesheets/Components/_navbar.scss
Environments/development.rb
config.assets.debug = true
config.assets.quiet = true
config.assets.compile = true
application.rb
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module RailsJwt
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
end
end
I am new here so I don't know which other parts of my application I should show.
Since you converted an API-only Rails application to use CSS I'm assuming you haven't configured Webpacker to handle your front end assets. This link may be helpful: https://onrails.blog/2020/02/20/using-css-in-rails-6/
The most important for you is probably adding the following to your app/views/application.html.erb file:
<%= stylesheet_link_tag 'application', media: 'all' %>
If you're using Webpacker, adjust accordingly. Also, I don't think Rails 6 ships with the sprockets gem so you may have to add that to your Gemfile, unless you plan on using Webpacker.
I have installed gem 'owlcarousel-rails' on Rails 6 but get the error message: couldn't find file 'owl.theme' with type 'text/css'. Thanks if anyone is able to help!
Error message
I'm simply added the owl.theme.default.css file into the stylesheets folder of my Rails project.
The themes are available on the Github page of the Gem:
https://github.com/acrogenesis/owlcarousel-rails/tree/master/vendor/assets/stylesheets
After I upgraded from Rails 5 to 6.1, the ActiveStorage raises an error:
unknown attribute 'service_name' for ActiveStorage::Blob.
Why, and how can I fix it?
These commands worked for me.
rails active_storage:update
rails db:migrate
Gemfile without the error:
gem 'rails', '~> 6.0.2'
Gemfile with the error:
gem 'rails', github: 'rails/rails', branch: 'master'
If you were already using active_storage and want to update your rails version to 6.1.0alpha, you have to run
rails active_storage:update
this will give you 2 new active_storage migrations that are needed for active_storage to work properly.
Migration 1:
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end
change_column :active_storage_blobs, :service_name, :string, null: false
end
end
end
Migration 2:
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def up
create_table :active_storage_variant_records do |t|
t.belongs_to :blob, null: false, index: false
t.string :variation_digest, null: false
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
end
Than you just run
rails db:migrate
It works.
This is taken care of in the normal upgrade process:
rails app:update
rails db:migrate
This solution to the service_name change gets a mention in the 6.1 Release Notes. The rails app:update task calls the internal rails active_storage:update for you since Rails 6.0.0 (source).
step 1:
rm 20191021084642_create_active_storage_tables.active_storage.rb
step 2:
rails active_storage:install
step 3:
rails db:migrate
I am receiving this error when I try to load a page in my new rails 5.1 app using webpacker. I would like webpacker to handle CSS as well.
Started GET "/" for ::1 at 2017-09-01 12:20:23 -0400
Processing by HomeController#welcome as HTML
Rendering home/welcome.html.erb within layouts/application
Rendered home/welcome.html.erb within layouts/application (0.4ms)
Completed 500 Internal Server Error in 28ms
ActionView::Template::Error (Webpacker can't find application.css in /Users/myusername/Documents/testing-ground/myapp/public/packs/manifest.json. Possible causes:
1. You want to set wepbacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. Webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your Webpack configuration is not creating a manifest.
Your manifest contains:
{
"application.js": "/packs/application-1ba6db9cf5c0fb48c785.js",
"hello_react.js": "/packs/hello_react-812cbb4d606734bec7a9.js"
}
):
7: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9: <%= javascript_pack_tag 'application' %>
10: <%= stylesheet_pack_tag 'application' %>
11: </head>
12:
13: <body>
app/views/layouts/application.html.erb:10:in `_app_views_layouts_application_html_erb__1178607493020013329_70339213085820'
I am running the ./bin/webpack-dev-server alongside the rails server. I created the app using:
rails new myapp --webpack
bundle
bundle exec rails webpacker:install:react
I have a single CSS file app/javascript/src/application.css. (Writing that makes me feel something is wrong. Putting css inside of a javascript directory seems improper.)
I just have single root route defined root to: 'home#welcome'.
Here is app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Myapp</title>
<%= csrf_meta_tags %>
<%= javascript_pack_tag 'application' %>
<%= stylesheet_pack_tag 'application' %>
</head>
<body>
<%= yield %>
</body>
</html>
Here is my config/webpacker.yml (I have tried also setting compile to false in development.
# Note: You must restart bin/webpack-dev-server for changes to take effect
default: &default
source_path: app/javascript
source_entry_path: packs
public_output_path: packs
cache_path: tmp/cache/webpacker
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: []
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
extensions:
- .coffee
- .erb
- .js
- .jsx
- .ts
- .vue
- .sass
- .scss
- .css
- .png
- .svg
- .gif
- .jpeg
- .jpg
development:
<<: *default
compile: true
dev_server:
host: localhost
port: 3035
hmr: false
https: false
test:
<<: *default
compile: true
# Compile test packs to a separate directory
public_output_path: packs-test
production:
<<: *default
# Production demands on precompilation of packs prior to booting for performance.
compile: false
# Cache manifest.json for performance
cache_manifest: true
I don't want to add too many details up-front incase they are more distracting then helpful. Please ask for anything else and I'll add to my question. Thanks!
In your application.js :
import "path to application.css"
I had this exact problem, on Rails 5.2 with Webpack's current version as of Dec 5, 2018 (4.2.x?) and just resolved it.
The fix for me was renaming application.css to anything else. I think there was a naming collision with Webpack.
So now my pack tags look like:
<%= stylesheet_pack_tag 'styles', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
I did NOT need to import the stylesheet inside application.js. This appears to make no difference for me.
OPTIONAL BONUS: I also renamed the app/javascript to app/webpack because I also thought it was confusing to run styles out of a Javascript directory (and learned from this youtube video that it could be done: https://www.youtube.com/watch?v=I_GGYIWbmg0&feature=youtu.be&t=32m35s). Simply:
Rename the directory to app/webpack
Adjust webpacker.yml like so: source_path: app/webpack
Hope that helps.
When HMR is set to false the styles are inlined within the bundle so you won't get any css bundle.
In your webpacker.yml file, setting hmr to true should fix your problem.
I realize this is an old question. Relevant, though.
In "config/environments/production.rb":
config.public_file_server.enabled = true
Delete "public/assets" and "public/pack"
And run:
RAILS_ENV=production bundle exec rake assets:precompile
I had the same problem and solved it with running yarn add postcss-smart-import in console.
upd: rails 5.2, webpacker 3.5, default config.
I had this problem or Rails 6.0.3.1.
I updated the file app/assets/config/manifest.js
//= link_directory ../../javascript/packs
//= link_directory ../images
Then restart in your terminal:
bin/webpack-dev-server
I had such problem even with import "path/to/application.css" line in application.js
In my case it was because test assets was precompiled with different node version
node modules was installed with node version v12
but test assets was compiled with with node version v10
assets were compiled but when I've looked inside public/pack-test/application.[hash].js and grep application.scss I saw an error line about node-sass missing.
In my cause problem was with Rubymine IDE - it somehow cache $PATH value from time when I had default node version v10 in nvm.
I hope my store will have somebody, who will encounter similar issue in future.
Revise Insallation Guide
Revise the version of webpacker (in package.json and Gemfile.lock with git story) if had recent changes withou you concerns.
All major errors are fixed when you revise: installation official guide
For me, for example, after revised I needed to add some files in /packs/application.js, include this at the top of the file:
import 'core-js/stable'
import 'regenerator-runtime/runtime'
I cleared webpacker's cache and it started working again for me:
rm -rf tmp/cache/webpacker
I'm working on the RoR3 Tutorial and i'm on chapter 6 when I tried the rakedb:migrate command. I received the message:
rake aborted!
undefined method `prerequisites' for nil:NilClass
I ignored the changes to the Gemfile because it already was installing sqlite3. When I changed it to 'sqlite3-ruby', '1.2.5' :required => 'sqlite3', i got an ActiveRecord::ConnectionNotEstablished message when trying to view the page locally. So, I just decided to not make that change.
I am using lion os, ruby 1.9.2p290, rails 3.1.0.rc8. Thx!
I'm working on the same tutorial at the moment, and ran into the same issue. After some digging, it turns out this is a bug with rspec-rails. If you look at rpsec-rails' change log for 2.6.1
guard against calling prerequisites on nil default rake task (Jack
Dempsey)
the book also doesn't get a chance to go into detail on what's going on when you run "bundle install", turns out bundler is meant to solve application dependencies: http://gembundler.com/rationale.html
Anyway, this was the solution: https://github.com/rails/rails/issues/1723
Change 'rspec-rails' under :development in your gemfile to:
gem 'rspec-rails', '2.6.1.beta1'
and 'rspec' under :test to
gem 'rspec', '2.6'
worked for me. Let me know if you want to work through the book together!