我遇到了问题,rails s和rails c不再工作,我已经尝试了很多方法,希望您能对我有所帮助。在我的终端中,我收到以下消息:
/Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require': cannot load such file -- sass (LoadError)
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:80:in `register'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:36:in `rescue in require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:25:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/font-awesome-sass-5.0.13/lib/font-awesome-sass.rb:48:in `configure_sass'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/font-awesome-sass-5.0.13/lib/font-awesome-sass.rb:13:in `load!'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/font-awesome-sass-5.0.13/lib/font-awesome-sass.rb:78:in `<main>'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:76:in `each'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:76:in `block in require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:65:in `each'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:65:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.1/lib/bundler.rb:114:in `require'
from /Users/carolinemaze/code/Caro1990/good_meal/config/application.rb:7:in `<main>'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:145:in `block in perform'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in `tap'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in `perform'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/command/base.rb:65:in `perform'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/command.rb:46:in `invoke'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/commands.rb:18:in `<main>'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
from /Users/carolinemaze/code/Caro1990/good_meal/bin/rails:9:in `<top (required)>'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:70:in `require'
from /Users/carolinemaze/.rbenv/versions/2.4.5/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:70:in `require'
from /Users/carolinemaze/code/Caro1990/good_meal/bin/spring:15:in `<top (required)>'
from ./bin/rails:3:in `load'
from ./bin/rails:3:in `<main>'````
我已经尝试过:
谢谢您的帮助!
更新:我的gemfile:
ruby '2.4.5'
gem 'bootsnap', require: false
gem 'jbuilder', '~> 2.0'
gem 'pg', '~> 0.21'
gem 'puma'
gem 'rails', '5.2.1'
gem 'redis'
gem 'autoprefixer-rails'
gem 'bootstrap-sass', '~> 3.3'
gem 'font-awesome-sass', '~> 5.0.9'
gem 'sassc-rails'
gem 'simple_form'
gem 'uglifier'
gem 'webpacker'
gem 'devise'
gem 'money-rails'
gem "pundit"
gem 'postmark-rails'
gem 'gibbon'
gem 'figaro'
group :development do
gem 'web-console', '>= 3.3.0'
end
group :development, :test do
gem 'letter_opener'
gem 'pry-byebug'
gem 'pry-rails'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'dotenv-rails'
end
gemfile.lock:
remote: https://rubygems.org/
specs:
actioncable (5.2.1)
actionpack (= 5.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.1)
actionpack (= 5.2.1)
actionview (= 5.2.1)
activejob (= 5.2.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.1)
actionview (= 5.2.1)
activesupport (= 5.2.1)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.1)
activesupport (= 5.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.1)
activesupport (= 5.2.1)
globalid (>= 0.3.6)
activemodel (5.2.1)
activesupport (= 5.2.1)
activerecord (5.2.1)
activemodel (= 5.2.1)
activesupport (= 5.2.1)
arel (>= 9.0)
activestorage (5.2.1)
actionpack (= 5.2.1)
activerecord (= 5.2.1)
marcel (~> 0.3.1)
activesupport (5.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
arel (9.0.0)
autoprefixer-rails (9.4.9)
execjs
bcrypt (3.1.12)
bindex (0.5.0)
bootsnap (1.4.1)
msgpack (~> 1.0)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
builder (3.2.3)
byebug (11.0.0)
coderay (1.1.2)
concurrent-ruby (1.1.4)
crass (1.0.4)
devise (4.6.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
responders
warden (~> 1.2.3)
dotenv (2.7.1)
dotenv-rails (2.7.1)
dotenv (= 2.7.1)
railties (>= 3.2, < 6.1)
erubi (1.8.0)
execjs (2.7.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.10.0)
figaro (1.1.1)
thor (~> 0.14)
font-awesome-sass (5.0.13)
sassc (>= 1.11)
gibbon (3.2.0)
faraday (>= 0.9.1)
multi_json (>= 1.11.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.5.3)
concurrent-ruby (~> 1.0)
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
json (2.2.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.7.0)
launchy (~> 2.2)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mimemagic (0.3.3)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.11.3)
monetize (1.9.1)
money (~> 6.12)
money (6.13.2)
i18n (>= 0.6.4, <= 2)
money-rails (1.13.1)
activesupport (>= 3.0)
monetize (~> 1.9.0)
money (~> 6.13.0)
railties (>= 3.0)
msgpack (1.2.6)
multi_json (1.13.1)
multipart-post (2.0.0)
nio4r (2.3.1)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
pg (0.21.0)
postmark (1.15.0)
json
postmark-rails (0.19.0)
actionmailer (>= 3.0.0)
postmark (~> 1.15.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
byebug (~> 11.0)
pry (~> 0.10)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (3.0.3)
puma (3.12.0)
pundit (2.0.1)
activesupport (>= 3.0.0)
rack (2.0.6)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.1)
actioncable (= 5.2.1)
actionmailer (= 5.2.1)
actionpack (= 5.2.1)
actionview (= 5.2.1)
activejob (= 5.2.1)
activemodel (= 5.2.1)
activerecord (= 5.2.1)
activestorage (= 5.2.1)
activesupport (= 5.2.1)
bundler (>= 1.3.0)
railties (= 5.2.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.1)
actionpack (= 5.2.1)
activesupport (= 5.2.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
redis (4.1.0)
responders (2.4.1)
actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
sassc (2.0.1)
ffi (~> 1.9)
rake
sassc-rails (2.1.0)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
simple_form (4.1.0)
actionpack (>= 5.0)
activemodel (>= 5.0)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webpacker (3.5.5)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
PLATFORMS
ruby
DEPENDENCIES
autoprefixer-rails
bootsnap
bootstrap-sass (~> 3.3)
devise
dotenv-rails
figaro
font-awesome-sass (~> 5.0.9)
gibbon
jbuilder (~> 2.0)
letter_opener
listen (~> 3.0.5)
money-rails
pg (~> 0.21)
postmark-rails
pry-byebug
pry-rails
puma
pundit
rails (= 5.2.1)
redis
sassc-rails
simple_form
spring
spring-watcher-listen (~> 2.0.0)
uglifier
web-console (>= 3.3.0)
webpacker
RUBY VERSION
ruby 2.4.5p335
BUNDLED WITH
1.17.1
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 GoodMeal
class Application < Rails::Application
config.generators do |generate|
generate.assets false
generate.helper false
generate.test_framework :test_unit, fixture: false
end
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
# 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
# POUR ACTIVER .ENV
Dotenv::Railtie.load
HOSTNAME = ENV['HOSTNAME']
end
bin / rails:
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
boot.rb:
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
答案 0 :(得分:0)
在日志的这一行中:
from /Users/carolinemaze/code/Caro1990/good_meal/config/application.rb:7:
似乎您的代码需要的文件不再存在。您可以确切找到config/application.rb:7
另外,请尝试从gem 'sassc-rails'
删除group :assets
答案 1 :(得分:0)
最后,我找到了解决问题的方法:更新红宝石版本,并在Gemefile中包含:gem'sass-rails',要求:false。现在工作了。谢谢大家的帮助。
ruby '2.5.3'
gem 'bootsnap', require: false
gem 'jbuilder', '~> 2.0'
gem 'pg', '~> 0.21'
gem 'puma'
gem 'sassc-rails'
gem 'sass-rails', require: false
gem 'bootstrap-sass', '~> 3.3'
gem 'font-awesome-sass', '~> 5.0.9'
gem 'rails', '5.2.1'
gem 'redis'
gem 'autoprefixer-rails'
gem 'simple_form'
gem 'uglifier'
gem 'webpacker'
gem 'devise'
gem 'money-rails'
gem "pundit"
gem 'postmark-rails'
gem 'gibbon'
# gem 'figaro'
group :development do
gem 'web-console', '>= 3.3.0'
end
group :development, :test do
gem 'letter_opener'
gem 'pry-byebug'
gem 'pry-rails'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'dotenv-rails', :require => 'dotenv/rails-now'
gem 'dotenv'
end