Search code examples
javascriptrequirejscharles-proxy

Require.js timeout with Charles proxy


Code works absolutely fine but when Charles proxy running in background, I get following error in Chrome and Firefox. Charles proxy is running at default settings.

Uncaught Error: Load timeout for modules: jQuery,handlebars http://requirejs.org/docs/errors.html#timeout require.js:8
F require.js:8
C require.js:13
(anonymous function)

OS: OS X 10.8.4
Charles: v 3.7 
Chrome : 28.0.1500.71
Firefox : 22.0 

Solution

  • Turns out the issue was related to hosts file. Requirejs was throwing timeout because localhost was taking too long to resolve. Everything works fine after updating hosts file to this:

    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting.  Do not change this entry.
    ##
    127.0.0.1 localhost.localdomain  
    127.0.0.1 localhost 
    127.0.0.1 username.lmuk.local
    255.255.255.255  broadcasthost
    ::1              localhost 
    fe80::1%lo0      localhost
    

    More information available here.