jdog
jdog

Reputation: 10759

Failed to load resource: the server responded with a status of 404 (Not Found) javascript/application.js

Running my ROR app with Puma locally. Getting the following error trying to load javascript/application.js

Failed to load resource: the server responded with a status of 404 (Not Found) javascript/application.js

Keep in mind this was a Ruby 1.9.3 app that I just updated the GEM file to 2.3.1

Does anything need to be changed when running a Rails app locally?

The source code shows

  <script src="/javascripts/application.js"></script>
  <link href="/bootstrap.min.css" rel="stylesheet">
  <link href="/bootstrap-responsive.min.css" rel="stylesheet">

Upvotes: 0

Views: 512

Answers (2)

kasperite
kasperite

Reputation: 2478

Locally, javascript files should be under app/assets/javascripts. They will be compressed, minified and copied into public during assets compilation (deployment)

Looks like there's no js files under /public/javascripts hence the 404 error you are getting.

It's also worth checking that you are starting the app in development mode. Otherwise, rails will look into public for js and css files.

See https://guides.rubyonrails.org/asset_pipeline.html#asset-organization for more details.

Upvotes: 1

sonic
sonic

Reputation: 1431

As I can see in my projects there is this kind of path

/assets/js/...

but maybe earlier was diffrent convetion.

Do you use static assets or dynamic on local ?

Upvotes: 0

Related Questions