18

I am testing an html webpage and it is failing to load a local jquery.json-2.4.0.js. I am testing the html page locally from chrome. When the page loaded I get a net::ERR_FILE_NOT_FOUND.

Why is it unable to load the file? This file has been moved from a different server (which it was working fine on), but the directory paths are the same (I double checked the path ).

Here is my line:

<script type='text/javascript' src='/webforms/ExperianEmailJsScripts/jquery/js/jquery.jsonp-2.4.0.js'></script>
user2133925
  • 377
  • 2
  • 4
  • 15
  • Try another browser than Chrome. If error disappears it is an issue of Chrome outside control of Javascript. Also Window may change filenames. –  Jun 26 '19 at 11:35
  • Update: there is a solution on GitHub [here](https://github.com/parcel-bundler/parcel/issues/470#issuecomment-354734896). – applemonkey496 Jun 01 '20 at 15:41

7 Answers7

22

Remove the first / in the path. Also you don't need type="text/javascript" anymore in HTML5.

Zak
  • 1,910
  • 3
  • 16
  • 31
  • still doesn't want to load the file – user2133925 Sep 04 '15 at 20:19
  • 1
    OK, try using the full path of the file, just for the moment. E.g. if you're on Windows it might be file:///C:/..../something.js – Zak Sep 04 '15 at 20:21
  • Do you have sources to support that `type="text/javascript"` is optionnal in HTML5? – D4V1D Sep 04 '15 at 20:26
  • @D4V1D Sure, take a look at http://stackoverflow.com/questions/5265202/do-you-need-text-javascript-specified-in-your-script-tags. – Zak Sep 04 '15 at 20:32
  • @Zak: Thanks for that! I'll leave it out from now on. – D4V1D Sep 04 '15 at 20:32
  • Upvoted it, although I'm not sure that the leading `/` is the problem. It'll do for the optional `text/javascript` then (good luck in your way from getting to editing reviews soon :)) – D4V1D Sep 04 '15 at 20:34
  • Thanks, I suspect that the real problem is that some directory is misnamed! Quite hard to tell though without being on the OP's computer. – Zak Sep 04 '15 at 20:36
  • @Zak Hi zak I have a similar problem, how different is this problem when deploying in windows vs. in ubuntu? On ubuntu, it runs fine without any problems but on windows i also obtained the error as D4V1D. – penguin Dec 24 '19 at 11:23
10

This error means that file was not found. Either path is wrong or file is not present where you want it to be. Try to access it by entering source address in your browser to check if it really is there. Browse the directories on server to ensure the path is correct. You may even copy and paste the relative path to be certain it is alright.

ezpn
  • 1,748
  • 15
  • 22
3

I got the same error using:

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i,900,900i" type="text/css" media="all">

But once I added https: in the beginning of the href the error disappeared.

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i,900,900i" type="text/css" media="all">
Thiago Farias
  • 301
  • 2
  • 7
2

Sometime when you downloading a project from other people, they might have some special customization. So, in my case I downloaded this project https://github.com/thecodercoder/fem-easybank

And got these errors: Failed to load resource: net::ERR_FILE_NOT_FOUND Errors That happed because the creator was using the /dist folder customization.

SOLUTION

https://youtu.be/aoQ6S1a32j8?t=309

SOLUTION: you open Notepad++ press: Ctrl + F for search find all folders that starts with / as in the picture and replace with norma ones like: /dist/ to dist

enter image description here

MikeRyz
  • 209
  • 1
  • 3
  • 18
1

Same thing happened to me. Eventually my solution was to navigate to the repository using terminal (on mac) and create a new js file with a slightly different name. It linked immediately so i copied contents of original file to new one. You also might want to lose the first / after src= and use "".

0

Instead of:

path.join(__dirname, '/dcp-electron/index.html')

you should add a dot at the start of the path, to indicate that the path is relative:

path.join(__dirname, './dcp-electron/index.html')

gunwin
  • 4,578
  • 5
  • 37
  • 59
0

this can happen when you have the base tag, as explained in other answers

 <base href="/">
Andreas Panagiotidis
  • 2,763
  • 35
  • 32