Question

I am a newbie to Ruby and working on my first project. Here are the versions I am using...

  • ruby 2.1.1p76
  • Rails 4.1.0

I am having trouble adding my JavaScript files. I am following this article (specially the Site-wide Scripts part) After reading the article, I saved the jquery.js & jquery.validate.min.js under vendor/assets/javascripts and my own script accRefConfig.js under app/assets/javascripts/additionalJS directory

So here is how my app/assets/javascripts/application.js manifest looks like (didn't delete the comments, hope that doesn't matter):

  // 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 vendor/assets/javascripts of plugins, if any, 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.
  // 
  // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details about supported directives.
  // 
  // = require jquery
  // = require jquery.validate.min
  // = require_tree ./additionalJS

And my application layout...

   <head>
      <title>Hello World</title>
      <%= stylesheet_link_tag "application.css", media: "all", "data-turbolinks-track" => true %>
      <%= javascript_include_tag "application" %>
  </head>

But this is giving me the following error.... enter image description here

What am I doing wrong? Thanks in advance for your time & help :)

BTW, I also tried <%= javascript_include_tag "application.js" %>, but same error msg

Was it helpful?

Solution

See that the error is throwing says .../jquery.js has an invalid UTF-8 byte secuence.

Try resaving the file as UTF-8.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top