2017-07-14 3 views
0

私はjsファイル(外部ライブラリ)をダウンロードするだけで、すべてがうまく動作しました。今はjs-librariesを糸でインストールしました。 node_modules.gitignoreに追加された場合は関係ありませんが、私が追加または.gitignoreへ/から/node_modulesを削除した場合、私はいつもcap production deploycapistranoとyarn資産を使ってrails 5.xアプリを配備する適切な方法は何ですか?

Tasks: TOP => deploy:assets:precompile 
(See full trace by running task with --trace) 
The deploy has failed with an error: Exception while executing on host 92.53.97.113: rake exit status: 1 
rake stdout: rake aborted! 
Sprockets::FileNotFound: couldn't find file 'jquery' with type 'application/javascript' 
Checked in these paths: 

時にこのエラーを受け取った私は、エラーを理解できる - 私のJS-ファイルがこのディレクトリに物理的にあるので、私はそれを無視している、それは合理的な、つまり、jqueryが見つかりません。しかし、を.gitignoreから削除すると、エラーは解決しません。

私は私のdeploy.rbpicked from this so question)に、このコードスニペットを追加して、私のgemfileにcapistrano-yarnを追加しようとしました:

set :nvm_type, :user # or :system, depends on your nvm setup 
set :nvm_node, 'v7.10.0' 
set :nvm_map_bins, %w{node npm yarn} 

set :yarn_target_path, -> { release_path.join('client') } # 
set :yarn_flags, '--production --silent --no-progress' # default 
set :yarn_roles, :all          # default 
set :yarn_env_variables, {} 

しかし、それはより多くの暗闇の中で選んだ、私は実際に私は何を知っていないので、やって

私は、資産が糸で管理されているレールアプリを配備する方法に関する適切なチュートリアルを見つけることができません。アドバイスはありますか? 誰かが論理を説明することができます、私の生産は資産をどこから得るでしょうか? node_modulesフォルダ?誰もがそれを.gitignoreに追加することを提案したら、どこから来たのですか?

編集: このアプリは当初は4.x Railsアプリであり、今すぐRails 5.1.2までアップデートされたことに気づくかもしれません。

また、私application.jsは次のようになります。

//= require jquery 
//= require rails-ujs 


//= require_tree ../../../vendor/assets/javascripts/front/first/. 

//= require front/second/jquery.bxslider 

//= require inputmask/dist/jquery.inputmask.bundle 
//= require inputmask/dist/inputmask/phone-codes/phone 
//= require inputmask/dist/inputmask/phone-codes/phone-be 
//= require inputmask/dist/inputmask/phone-codes/phone-ru 

//= require front/second/jquery.masonry.min 

//= require front/second/js-url.min 

//= require_tree ../../../vendor/assets/javascripts/front/third/. 


//= require_self 
//= require_tree ../../../app/assets/javascripts/front/. 
//= require turbolinks 

すべてが開発モードで正常に動作します。

答えて

0

最後に考え出しました。私は次のコードを実行する必要がありました:

bundle config --delete bin 
./bin/rails app:update:bin # or rails app:update:bin 

これはほとんどwebpackerの説明の一番下にhere

ました
関連する問題