2016-03-24 7 views
0

Ich habe stundenlang nach einer Lösung für dieses Problem gesucht, ohne Erfolg. Ich kann das anscheinend nicht beheben.Kann nicht auf Digital Ocean VPS mithilfe von Capistrano wegen JSON :: GeneratorError bereitgestellt werden: Quellsequenz ist illegal/falsch formatiert utf-8

*cap production deploy * throws the following error as shown in the log. This solution doesn't help.

Tasks: TOP => assets:precompile 
(See full trace by running task with --trace) 
(Backtrace restricted to imported tasks) 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: rake exit status: 1 
rake stdout: rake aborted! 
JSON::GeneratorError: source sequence is illegal/malformed utf-8 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/json-1.8.3/lib/json/common.rb:223:in `generate' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/json-1.8.3/lib/json/common.rb:223:in `generate' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:46:in `call' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/uglifier-2.7.2/lib/uglifier.rb:212:in `run_uglifyjs' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/uglifier-2.7.2/lib/uglifier.rb:179:in `compile' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/uglifier_compressor.rb:52:in `call' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/uglifier_compressor.rb:28:in `call' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/processor_utils.rb:75:in `call_processor' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/processor_utils.rb:56:in `reverse_each' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/processor_utils.rb:56:in `call_processors' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/loader.rb:134:in `load_from_unloaded' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/loader.rb:60:in `block in load' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/loader.rb:44:in `load' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/cached_environment.rb:20:in `block in initialize' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/cached_environment.rb:47:in `yield' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/cached_environment.rb:47:in `load' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/base.rb:66:in `find_asset' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/base.rb:73:in `find_all_linked_assets' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:138:in `block in find' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/path_utils.rb:223:in `block in stat_tree' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/path_utils.rb:207:in `block in stat_directory' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/path_utils.rb:204:in `each' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/path_utils.rb:204:in `stat_directory' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/path_utils.rb:222:in `stat_tree' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/legacy.rb:105:in `each' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/legacy.rb:105:in `block in logical_paths' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/legacy.rb:104:in `each' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/legacy.rb:104:in `logical_paths' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:136:in `find' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:162:in `compile' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-3.4.0/lib/rake/sprocketstask.rb:147:in `with_logger' 
/var/www/html/app/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define' 
Tasks: TOP => assets:precompile 
(See full trace by running task with --trace) 
rake stderr: Nothing written 


    [1]: https://stackoverflow.com/questions/31372478/rake-aborted-jsongeneratorerror-source-sequence-is-illegal-malformed-utf-8-a 

Ich bin an einer Lösung

+0

Erhalten Sie den gleichen Fehler, wenn Sie Bündel Exec Take Assets ausführen: lokal vorkompilieren? –

+0

@will_in_wi ruft 'bundle exec Rake Assets: precompile RAILS_ENV = production' lokal bringt den gleichen Fehler. Calling 'bundle exec Rake Vermögenswerte: precompile RAILS_ENV = Entwicklung' lokal bringt nichts – Esseme

Antwort

0

Einer der JS-Dateien kompiliert werden, enthält ungültige UTF-8-Byte geduldig warten. Ich weiß nicht, welche, aber die Art, wie ich vorschlagen, würde Sie sie debuggen lokal sind der äquivalenten Pfad zu /var/www/html/app/shared/bundle/ruby/2.2.0/gems/json-1.8.3/lib/json/common.rb:223:in generate'` zu bearbeiten, um den Bruch Anruf in einem Block zu wickeln wie:

begin 
    # Whatever normally goes here. 
rescue JSON::GeneratorError 
    puts whateverliststhefilename 
end 

Wenn Sie bereits sind Wenn Sie dies verwenden, können Sie auch binding.pry anstelle von Puts einfügen.

Sobald Sie den Dateinamen kennen, führen Sie ihn durch UTF-8-Validatoren wie den, den Sie in der verknüpften SO-Antwort gesehen haben, und beheben Sie ihn. Wenn sich der JS in einem Edelstein befindet, versuche, den Edelstein in einen makellosen Zustand zu versetzen. Wenn sich das JS in Ihrem Projekt befindet, beheben Sie es entsprechend.

Sie können http://guides.rubygems.org/command-reference/#gem-pristine verwenden, um ein geändertes oder beschädigtes Juwel wiederherzustellen. Stellen Sie sicher, dass Sie Ihren Debugging-Code aus der Gem-Datei entfernen, wenn Sie fertig sind.

Dies ist eher eine Lehre, wie Fisch Antwort als ein "das ist was falsch ist und wie es zu beheben" Antwort. Entschuldigung, aber es gibt keine Möglichkeit für uns, dies zu tun, es sei denn, es handelt sich um ein allgemein bekanntes Problem in einem Juwel, das eine Google-Suche ausgelöst hätte, oder wenn wir den gesamten Quellcode haben.

Hoffe, das hilft!

+0

danke für die rechtzeitige Antwort .. lass mich arbeiten. Ich werde dich wissen lassen, wie deine Überlegungen gehen – Esseme

+0

danke für die Lösung, aber es war nicht gut. – Esseme