http://localhost/undefined 404(未找到) [英] http://localhost/undefined 404 (Not Found)

查看:789
本文介绍了http://localhost/undefined 404(未找到)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题描述不清楚.让我再试一次.

I was not clear in my problem description. Let me try again.

NB.这是我的生产,暂存和开发站点(不仅仅是评论者似乎想到的我的开发站点)普遍存在的问题.

NB. This is a problem common to my production, staging, and development sites (not just to my delevlopment site as the commenters seem to have thought).

NB.用Chrome而不是Firefox会出现此问题.

NB. This problem occurs bowsing with Chrome and not with Firefox.

问题出现在网站主页上: http://www.example.com (或带有"/index.php附加").该页面加载成功,但是Chrome开发人员工具的控制台面板显示404错误.该消息显示为"GET http://www.example/undefined 404(未找到)".它始终显示在DOCTYPE行的(index):1"处发生的错误.不管产生什么问题,事实并非如此.

The problem occurs at the site home page: http://www.example.com (or with "/index.php appended"). The page loads successfully, but the Console pannel of Chrome's Developer Tools shows a 404 error. The message reads "GET http://www.example/undefined 404 (Not Found)". It always shows the error as occuring at "(index):1" which is the DOCTYPE line. Whatever is generating the problem, it is not that.

该页面加载良好,我只是在开发人员工具控制台中收到了一条奇怪的消息. (在最初的问题描述中可能还不清楚.)Firfox的控制台未显示此类错误.

The page is loading fine, I just get this odd message in the Developers Tools Console. (I probably wasn't clear about that in the original problem description.) Firfox's console shows no such error.

我想找出导致此错误的原因.特别是,我想找到Chrome从何处获取未定义"网址.我的猜测(但仅是猜测)是我的许多Javascript文件之一是从未定义的变量生成URL. Chrome在问题中的位置((index):1)错误.对于如何从Chrome中获取更有用的错误消息的任何想法,我将不胜感激:在其中找到URL的文件名会有所帮助.如果我不必在所有Javascript文件中一一设置断点就可以做到这一点,那将特别好. :-)

I want to track down what is generating this error. In particular, I would like to find where Chrome is getting the "undefined" url. My guess (but only a guess) is that one of my many Javascript files is genrating a URL from an undefined variable. Chrome's location of the problem, "(index):1", is wrong. I would appreciate any ideas as to how to get a more useful error message out of Chrome: the name of the file where the URL was found would help. If I can do this without having set breakpoints in all my Javascript files one by one, that would be particularly nice. :-)

已删除URL的原始问题(我的信誉受限制,链接数限制为<10).您可能不想读它,因为人们对此感到困惑.

The original question with URL's removed (I'm limited in the number of links I'm allowed with a reputation < 10) follows. You may not want to read it as people have been confused by it.

我们有一个相当复杂的Drupal网站.转到主页时, Chrome(版本45.0.2454.85 m)控制台显示了一个错误:"[URL 删除] 404(未找到)(索引):1.(我正在使用开发网站 在我的本地计算机上,因为此处的缩小功能已关闭.)
好吧,我想,我知道该怎么办:去发现问题 在任何文件中找到点,挠挠我的头几次,变得光彩照人 想法,并解决问题.一个小难题:问题是 肯定在索引第1行发生了不是(我认为这是 (index):1"表示).错误消息中的未定义"提示但 不能证明罪犯是我们十几个人中的一员 JavaScript文件.大概某个变量在某处未定义. 因此,我该如何让Chrome浏览器找出冒犯者所在的位置 发生了吗?它没有给我任何未定义的值JavaScript错误, 在[URL删除]/undefined上只有404.预先感谢任何 想法.

We have rather complex Drupal website. When going to the homepage, the Chrome (Version 45.0.2454.85 m) Console shows me an error: "[URL removed] 404 (Not Found) (index):1". (I'm using the development site on my local computer because minification is turned off there.)
Okay, I think, I know what to do about that: Go find the offending spot in whatever file, scratch my head a few times, get a brilliant idea, and fix the problem. One little difficulty: the problem is surely not occurring at index, line 1 (which I assume is what "(index):1" means). The "undefined" in the error message suggests but does not prove that the offender is one of our about a dozen JavaScript files. Presumably some variable somewhere is undefined. So how do I get Chrome to cough up the location where the offense is occurring? It is not giving me any undefined value JavaScript errors, just a 404 on [URL removed]/undefined . Thanks in advance for any ideas.

我忘了补充一点,Firefox没有显示此类错误.

I forgot to add that Firefox is showing no such error.

推荐答案

我发现了可能出现此问题的地方.

I found where this issue could appear from.

  1. 确保所有生成的设置背景图像等的CSS(样式)实际上都指向url();如果它没有指向任何地方,则错误将设置为.html DOCTYPE.
  2. 检查图像标签的src;确保未将它们设置为未定义.
  3. 还要检查脚本文件的src,即使在这种情况下这种情况很少见.

是的,它确实不能指出实际错误在哪里,但实际上必须使用它无法找到的查找资源,这是很糟糕的.我们甚至可能不希望它进行搜索.例如.当元素不可见并且我们不设置任何图像时;但是我们仍然传递undefined,它将搜索undefined,并且不会提示您错误在树的哪一部分.

So yes it's awful that it actually doesn't point where the actual error is but in fact has to be with a lookup resource that it isn't able to find; we probably don't even want it to search. Eg. when the element is invisible and we don't set any image; but we still pass undefined it'll search for undefined and it'll not give you any hint of in which part of the tree the error is.

由于您的页面太复杂,无法知道它在哪里,或者这甚至不是您要面对的问题;这是我能说的最多的东西;我发现它太快的唯一原因是因为react开发工具立即告诉我渲染属性以及该组件很小的事实.

Since your page is too complex to know where it is, or if this is even the problem you are facing; this is the most I can tell; the only reason I could find it too quick was because of react dev tools told me right away of my render properties and the fact that the component was quite small.

这篇关于http://localhost/undefined 404(未找到)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆