JS files not found (404)

35,070

Solution 1

Solved.

It was a permissions issue. The PATHs were right but the problematic directories and files didn't have execute permissions.

EDIT(zpert): Make sure directory permissions are 755, which means:

  • Owner: Read, Write, Execute
  • Group: Read, Execute
  • Public: Read, Execute

Solution 2

In Chrome Developer Tools (F12 in Google Chrome), if you go to the sources tab you can see the content (css and js) that is on the page. It appears that some of your files are missing and some of the directories are incorrect.

It looks like with some of the content you assumed that support-wizard was the root directory when it isn't.

For example, some of your sources should be:

/support-wizard/libs/ladda/dist/spin.min.js
/support-wizard/libs/ladda/dist/ladda.min.js
/support-wizard/libs/bootstrap-toggle-master/css/bootstrap-toggle.min.css

enter image description here

If you try going to each page it should load (ie: ztsales.com/support-wizard/libs/ladda/dist/ladda.min.js)

Share:
35,070
Falpangaea
Author by

Falpangaea

Updated on September 22, 2020

Comments

  • Falpangaea
    Falpangaea over 3 years

    I'm running the application locally and it works fine. When I uploaded it to my hosting account I started getting 404 errors on JS

    It's happening in both Chrome and Firefox.

    Chrome Inspect Element Errors

    The directory structure

    The files are located in the designated location and the code is at the bottom of the page so they shouldn't be getting accessed before they're loaded.

     
    <script src="libs/bootstrap-switch-master/docs/js/jquery.min.js"></script>
    <script src="libs/bootstrap-toggle-master/js/bootstrap-toggle.min.js"></script>
    <script src="libs/angular/angular.js"></script>
    <script src="libs/angular/angular.min.js"></script>
    <script src="libs/angular-auto-validate/dist/jcs-auto-validate.min.js" ></script>
    <script src="libs/ladda/dist/spin.min.js" ></script>
    <script src="libs/ladda/dist/ladda.min.js" ></script>
    <script src="libs/angular-ladda/dist/angular-ladda.min.js"></script>
    <script src="libs/clipboard.js-master/dist/clipboard.min.js"></script>
    <script src="libs/jquery-color-master/jquery.color.js"></script>
    
    <script src="main.js" ></script>
    
    </body >
    </html >
  • Falpangaea
    Falpangaea almost 8 years
    If I add that to the PATHs, it still doesn't load them.
  • Eitan K
    Eitan K almost 8 years
    It fixed some of them, if you see the spin.min.js and ladda.min.js are now loaded. You need to check the paths of the other ones as well and see what is missing. Look at the sources tab in Chrome Developer Tools it is very useful. If you try going to each page it should load (ie: ztsales.com/support-wizard/libs/ladda/dist/ladda.min.js)
  • Black Sheep
    Black Sheep almost 8 years
    Thats not the problem... The problem is that the file doesn't exist anywhere.
  • Eitan K
    Eitan K almost 8 years
    Some of them seem to be missing, but some of them seem to have the wrong directory like the ones that I posted
  • Falpangaea
    Falpangaea almost 8 years
    They're definitely there in cpanel. Adding pics to the next post.
  • s.k.Soni
    s.k.Soni almost 7 years
    how you given the permission can give you show me. I also facing same issue. Thank You.
  • Solal
    Solal about 4 years
    @s.k.Soni run in terminal: chmod 755 your/directory