Как исправить ошибку Rails 6.0.0.beta1, которая уже просматривается? - PullRequest
0 голосов
/ 10 февраля 2019

У меня есть новое приложение rails, на котором запущен Rails 6.0.0.beta1, и я получаю эту ошибку, когда запускаю любую команду rails, такую ​​как rails s, rails test, rails db:migrate и т. Д.:

** ERROR: directory is already being watched! *

Я также получаю его при запуске bundle exec guard

Я довольно долго гуглял эту ошибку и не могу понять, что ее вызывает.Кто-нибудь знает, что может быть причиной этого?

Вот полный след ошибки:

rails s => Загрузка Puma => Приложение Rails 6.0.0.beta1, запускающееся в разработке => Выполнитьrails server --help для дополнительных параметров запуска ** ОШИБКА: каталог уже просматривается!**

    Directory: /Users/lee/Documents/Code/dashboard/node_modules/.bin/compression-webpack-plugin

    is already being watched through: /Users/lee/Documents/Code/dashboard/node_modules/compression-webpack-plugin

    MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
    ** ERROR: directory is already being watched! **

    Directory: /Users/lee/Documents/Code/dashboard/node_modules/.bin/mini-css-extract-plugin

    is already being watched through: /Users/lee/Documents/Code/dashboard/node_modules/mini-css-extract-plugin

    MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
    ** ERROR: directory is already being watched! **

    Directory: /Users/lee/Documents/Code/dashboard/node_modules/@rails/webpacker/node_modules/.bin/compression-webpack-plugin

    is already being watched through: /Users/lee/Documents/Code/dashboard/node_modules/compression-webpack-plugin

    MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
    ** ERROR: directory is already being watched! **

    Directory: /Users/lee/Documents/Code/dashboard/node_modules/@rails/webpacker/node_modules/.bin/mini-css-extract-plugin

    is already being watched through: /Users/lee/Documents/Code/dashboard/node_modules/mini-css-extract-plugin

    MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors

И вот мой Gemfile:

    source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.0'

# Rails 6
gem 'rails', '~> 6.0.0.beta1'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'webpacker', '>= 4.0.0.rc.3'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'bootsnap', '>= 1.1.0', require: false

# App Specific gems
gem 'clearance'
gem 'pundit'

# Development and test
group :development, :test do
  gem 'sqlite3'
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'factory_bot_rails'
  gem 'launchy'
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  gem 'capybara', '>= 2.15'
  gem 'capybara-webkit'
  gem 'capybara-email'
  gem 'faker'
  gem 'database_cleaner'
  gem 'rails-controller-testing'
  gem 'minitest'
  gem 'minitest-reporters'
  gem 'guard'
  gem 'guard-minitest'
end

group :production do
  gem 'pg'
end

И мой Guardfile:

# Defines the matching rules for Guard.
guard :minitest, spring: "bin/rails test", all_on_start: false do
  watch(%r{^test/(.*)/?(.*)_test\.rb$})
  watch('test/test_helper.rb') { 'test' }
  watch('config/routes.rb')    { integration_tests }
  watch(%r{^app/models/(.*?)\.rb$}) do |matches|
    "test/models/#{matches[1]}_test.rb"
  end
  watch(%r{^app/controllers/(.*?)_controller\.rb$}) do |matches|
    resource_tests(matches[1])
  end
  watch(%r{^app/views/([^/]*?)/.*\.html\.erb$}) do |matches|
    ["test/controllers/#{matches[1]}_controller_test.rb"] +
    integration_tests(matches[1])
  end
  watch(%r{^app/helpers/(.*?)_helper\.rb$}) do |matches|
    integration_tests(matches[1])
  end
  watch('app/views/layouts/application.html.erb') do
    'test/integration/site_layout_test.rb'
  end
  watch('app/helpers/sessions_helper.rb') do
    integration_tests << 'test/helpers/sessions_helper_test.rb'
  end
  watch('app/controllers/sessions_controller.rb') do
    ['test/controllers/sessions_controller_test.rb',
     'test/integration/users_login_test.rb']
  end
  watch('app/controllers/account_activations_controller.rb') do
    'test/integration/users_signup_test.rb'
  end
end

# Returns the integration tests corresponding to the given resource.
def integration_tests(resource = :all)
  if resource == :all
    Dir["test/integration/*"]
  else
    Dir["test/integration/#{resource}_*.rb"]
  end
end

# Returns the controller tests corresponding to the given resource.
def controller_test(resource)
  "test/controllers/#{resource}_controller_test.rb"
end

# Returns all tests for the given resource.
def resource_tests(resource)
  integration_tests(resource) << controller_test(resource)
end

Это, похоже, происходит только с Rails 6. Iу меня есть подобная настройка приложения на Rails 5, и я не получаю эту ошибку.

...