我在openshift上托管了我的服务器端(`Node js`和`Express js`)代码,从一周后我就收到了这个错误。怎么克服这个?

时间:2016-08-31 06:48:53

标签: node.js openshift

在网站上,几乎所有API都显示此错误

Failed to load resource: the server responded with a status of 502 (Proxy Error)

XMLHttpRequest cannot load. No 'Access-Control-Allow-Origin' header is present on the
requested resource. Origin is therefore not allowed access. The response had
HTTP status code 503.

注意: CORS已使用npm安装,但仍然出现上述错误。

有时会收到此错误

Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING

当使用rhc tail命令检查日志时,日志

C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/ssh/ruby_comp
at.rb:20:in `select': closed stream (IOError)
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/ruby_compat.rb:20:in `io_select'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/transport/packet_stream.rb:75:in `available_for_read?'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/transport/packet_stream.rb:87:in `next_packet'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/transport/session.rb:193:in `block in poll_message'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/transport/session.rb:188:in `loop'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/transport/session.rb:188:in `poll_message'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/connection/session.rb:513:in `dispatch_incoming_packets'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/connection/session.rb:237:in `ev_preprocess'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/connection/event_loop.rb:95:in `each'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/connection/event_loop.rb:95:in `ev_preprocess'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/connection/event_loop.rb:27:in `process'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/connection/session.rb:216:in `process'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/connection/session.rb:178:in `block in loop'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/connection/session.rb:178:in `loop'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh/connection/session.rb:178:in `loop'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rhc-1.38.7/lib/rhc/ssh_helpe
rs.rb:198:in `block in ssh_ruby'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/net-ssh-4.0.0.beta3/lib/net/
ssh.rb:245:in `start'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rhc-1.38.7/lib/rhc/ssh_helpe
rs.rb:173:in `ssh_ruby'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rhc-1.38.7/lib/rhc/commands/
tail.rb:40:in `tail'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rhc-1.38.7/lib/rhc/commands/
tail.rb:21:in `run'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rhc-1.38.7/lib/rhc/commands.
rb:294:in `execute'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rhc-1.38.7/lib/rhc/commands.
rb:285:in `block (3 levels) in to_commander'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commande
r/command.rb:180:in `call'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commande
r/command.rb:180:in `call'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commande
r/command.rb:155:in `run'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commande
r/runner.rb:421:in `run_active_command'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rhc-1.38.7/lib/rhc/command_r
unner.rb:72:in `run!'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commande
r/delegates.rb:8:in `run!'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rhc-1.38.7/lib/rhc/cli.rb:37
:in `start'
    from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rhc-1.38.7/bin/rhc:20:in `<t
op (required)>'
    from C:/Ruby21-x64/bin/rhc:23:in `load'
    from C:/Ruby21-x64/bin/rhc:23:in `<main>'

我在哪里做错了?

1 个答案:

答案 0 :(得分:0)

我觉得你安装了错误的Ruby版本。我认为只有版本1.86到2.0才有效。卸载Ruby并重新安装早期版本。