简体   繁体   English

NodeJS服务器不提供整个文件?

[英]NodeJS server not serving entire files?

This is a classic "it worked last night when I went to bed!" 这是经典的“昨晚睡觉时起作用!” situations... 情况...

My site is built on the MEAN stack (meanjs.org), and my page now fails to load in Chrome and IE, but seems to work fine in FireFox. 我的网站建立在MEAN堆栈(meanjs.org)上,现在我的页面无法在Chrome和IE中加载,但在FireFox中似乎可以正常工作。 It simply displays a blank white screen. 它仅显示空白屏幕。 I see these as the first 2 errors in the console: 我将这些视为控制台中的前2个错误:

socket.io.js:3032 Uncaught SyntaxError: Unexpected end of input
angular.min.js:95 Uncaught SyntaxError: missing ) after argument list

In inspecting those files, it seems they only loaded partially. 在检查这些文件时,似乎它们仅被部分加载。 I've compared them with the files on my server, and they're simply being cut off, but they're being cut off at the same point every time. 我已经将它们与服务器上的文件进行了比较,它们只是被切断,但是每次都在同一时间被切断。

Earlier this morning, on an entirely different network (at a hotel), I was getting this error: 今天早上,在一个完全不同的网络(在酒店)上,我收到此错误:

net::ERR_INCOMPLETE_CHUNKED_ENCODING

Unfortunately, searching on Google and SO typically shows instances of user syntax error, but I haven't touched my socket.io file or my angular.min.js file (I didn't even know where my socket.io file was until this morning). 不幸的是,在Google和SO上进行搜索通常会显示用户语法错误的实例,但是我还没有碰过我的socket.io文件或angular.min.js文件(在此之前,我什至都不知道我的socket.io文件在哪里)早上)。

Any help on this one?? 对这个有什么帮助吗? I'm stumped. 我很沮丧

Short Answer: Restart NGINX - it was a caching issue. 简短答案:重新启动NGINX-这是一个缓存问题。

OK, at one point, I got net::ERR_CONTENT_LENGTH_MISMATCH on my favicon. 好的,在某一时刻,我的net::ERR_CONTENT_LENGTH_MISMATCH上显示net::ERR_CONTENT_LENGTH_MISMATCH When searching this error, I found this post describing nginx issues. 搜索此错误时,我发现此帖子描述了nginx问题。 When looking through my nginx error logs, I found these lines: 查看我的nginx错误日志时,发现以下几行:

2016/11/24 12:08:14 [crit] 31776#0: *559245 open() "/tmp/nginx_proxy/0000094496" failed (2: No su
ch file or directory) while reading upstream, client: xx.xxx.xxx.xxx, server: myserver, request: "G
ET /socket.io/socket.io.js HTTP/1.1", upstream: "http://xxx.x.x.x:xxxx/socket.io/socket.io.js", h
ost: "myhost.com", referrer: "http://myhost.com/url/path"

2016/11/24 12:08:14 [crit] 31776#0: *559248 open() "/tmp/nginx_proxy/0000094497" failed (2: No su
ch file or directory) while reading upstream, client: xx.xxx.xxx.xxx, server: myserver, request: "G
ET /lib/angular/angular.min.js HTTP/1.1", upstream: "http://xxx.x.x.x:xxxx/lib/angular/angular.mi
n.js", host: "myhost.com", referrer: "http://myhost.com/url/path"

2016/11/24 12:08:17 [crit] 31776#0: *559238 open() "/tmp/nginx_proxy/0000094498" failed (2: No su
ch file or directory) while reading upstream, client: xx.xxx.xxx.xxx, server: myserver, request: "G
ET /modules/core/client/img/brand/favicon.ico HTTP/1.1", upstream: "http://xxx.x.x.x:xxxx/modules
/core/client/img/brand/favicon.ico", host: "myhost.com", referrer: "http://myhost.com/url/path"

When I looked in /tmp I saw no nginx_proxy directory at all. 当我查看/tmp ,根本看不到nginx_proxy目录。

In the end, I just restarted nginx and the issue magically went away. 最后,我只是重新启动了Nginx,问题神奇地消失了。 I now reload my page without problem, and I see no more errors in the log. 现在,我重新加载页面没有问题,并且日志中没有其他错误。

Updating question with correct tags as well. 也使用正确的标签更新问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM