2016-09-02 13 views
11

मैंने अभी अपना ऐप Rails 4.2.7 से Rails 5.0.0.1 पर अपग्रेड किया है। मैंने यह सुनिश्चित करने के लिए RailsDiff का उपयोग किया था कि मेरे पास सब कुछ शामिल था और मुझे विश्वास है कि मैंने किया था। अभी तक सब कुछ मेरे ऐप की लोडिंग तक अच्छी तरह से काम किया है।requ_tree तर्क रेल 5 में एक निर्देशिका होना चाहिए अपग्रेड किया गया ऐप

अब मैं यह त्रुटि देख रहा हूँ:

Sprockets::ArgumentError at/
require_tree argument must be a directory 

यह मेरा application.css:

/* 
* This is a manifest file that'll be compiled into application.css, which will include all the files 
* listed below. 
* 
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 
* 
* You're free to add application-wide styles to this file and they'll appear at the bottom of the 
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 
* files in this directory. Styles in this file should be added after the last require_* statement. 
* It is generally better to create a new file per style scope. * 
*= require_tree . 
*= require_self 
*/ 

यह मेरा application.js

// This is a manifest file that'll be compiled into application.js, which will include all the files 
// listed below. 
// 
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 
// 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// compiled file. JavaScript code in this file should be added after the last require_* statement. 
// 
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 
// about supported directives. 
// 
//= require jquery 
//= require jquery_ujs 
//= require turbolinks 
//= require_tree . 

यह वही सर्वर लॉग की तरह लग रहा है:

Started GET "/" for ::1 at 2016-09-02 09:08:19 -0500 
    ActiveRecord::SchemaMigration Load (1.5ms) SELECT "schema_migrations".* FROM "schema_migrations" 
    User Load (1.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]] 
Processing by ProfilesController#index as HTML 
    Rendering profiles/index.html.erb within layouts/application 
    Profile Load (1.6ms) SELECT "profiles".* FROM "profiles" 
    Rendered profiles/index.html.erb within layouts/application (45.8ms) 
Completed 500 Internal Server Error in 367ms (ActiveRecord: 6.3ms) 


DEPRECATION WARNING: #original_exception is deprecated. Use #cause instead. (called from initialize at /.rvm/gems/[email protected]/gems/better_errors-2.1.1/lib/better_errors/raised_exception.rb:7) 
DEPRECATION WARNING: #original_exception is deprecated. Use #cause instead. (called from initialize at /.rvm/gems/ruby-2.3.1myapp/gems/better_errors-2.1.1/lib/better_errors/raised_exception.rb:8) 

Sprockets::ArgumentError - require_tree argument must be a directory: 
    sprockets (3.7.0) lib/sprockets/directive_processor.rb:182:in `rescue in block in process_directives' 
    sprockets (3.7.0) lib/sprockets/directive_processor.rb:179:in `block in process_directives' 
    sprockets (3.7.0) lib/sprockets/directive_processor.rb:178:in `process_directives' 

मैं किसी भी प्रकार का कोई प्लगइन उपयोग नहीं कर रहा हूं। यह एक काफी सरल/वेनिला ऐप है। एकमात्र स्टाइल डिफ़ॉल्ट scaffold.scss से है।

इसका कारण क्या हो सकता है?

उत्तर

25

मैंने अंततः इसे समझ लिया। इसलिए क्योंकि मैं अपग्रेड कर रहा हूं, रेल डिफ ने मुझे यह नहीं बताया कि मुझे कुछ याद आ रहा था।

तो त्रुटि संदेश गलत नहीं था, हालांकि, मैं जो करना भूल गया था वह खाली निर्देशिका बनाना था।

//= require_tree ./channels 

हालांकि, मैं वास्तव में उस फ़ोल्डर बनाने के लिए भूल गया:

मेरी app/assets/javascripts/cable.js में, मैं निम्नलिखित था।

तो इसे ठीक करने के लिए, मुझे बस app/assets/javascriptschannels नामक एक खाली फ़ोल्डर बनाना था। इसके अलावा, क्योंकि गिट खाली निर्देशिका को अनदेखा करता है, उस नए बनाए गए फ़ोल्डर में, मुझे .keep नामक एक खाली फ़ाइल भी बनाना पड़ा।

तो एक बार मैं निम्नलिखित किया था, सब कुछ एक आकर्षण की तरह काम किया:

  • फ़ोल्डर बनाएं: app/assets/javascripts/channels
  • कि फ़ोल्डर के भीतर खाली फ़ाइल बनाएँ: app/assets/javascripts/channels/.keep

सब कुछ अब पूरी तरह से काम करता है।

संबंधित मुद्दे