Uncaught ReferenceError: require is not defined

Bug Reports
  • Hi.

    I'm trying to make a post in my newly installed nodebb but "New Topic" button just doesn't do anything and in console I see these errors:

    Uncaught ReferenceError: require is not defined general-discussion:37(anonymous function) general-discussion:37
    Uncaught ReferenceError: require is not defined general-discussion:403(anonymous function)

    Anyone knows what's going on?


Suggested Topics


  • 0 Votes
    1 Posts
    1k Views

    in home page:

    Running nodebb in DEV mode :

    12/12 18:28 [29442] - info: [plugins] Plugins OK 12/12 18:28 [29442] - verbose: [meta/css] Minifying LESS/CSS 12/12 18:28 [29442] - verbose: [sounds] Sounds OK 12/12 18:28 [29442] - verbose: [meta/templates] Compiling templates 12/12 18:28 [29442] - verbose: [meta/js] Minification complete 12/12 18:28 [29442] - verbose: [meta/js] Client-side minfile committed to disk. 12/12 18:28 [29442] - verbose: [meta/templates] Successfully compiled templates. 12/12 18:28 [29442] - info: NodeBB Ready 12/12 18:28 [29442] - info: Enabling 'trust proxy' 12/12 18:28 [29442] - info: NodeBB is now listening on: 0.0.0.0:4567 12/12 18:28 [29442] - verbose: [hotswap] Router with id `auth` replaced successfully 12/12 18:28 [29442] - verbose: [meta/css] admin.css committed to disk. 12/12 18:28 [29442] - info: [plugins/spam-be-gone] Settings loaded 12/12 18:28 [29442] - verbose: [meta/css] stylesheet.css committed to disk. 12/12 18:28 [29442] - verbose: [hotswap] Router with id `plugins` replaced successfully 12/12 18:28 [29442] - verbose: [plugins] All plugins reloaded and rerouted 12/12 18:30 [29442] - warn: Route requested but not found: /vendor/jquery/timeago/locales/jquery.timeago.fa-short.js?_=1449932506270 12/12 18:36 [29442] - warn: Route requested but not found: /vendor/jquery/timeago/locales/jquery.timeago.fa-short.js?_=1449932876822

    an I have this errors on Chrome console:

    GET http://127.0.0.1:4567/plugins/nodebb-plugin-emoji-extended/images/exclamation.png net::ERR_CONNECTION_REFUSED (index):1665 GET http://127.0.0.1:4567/plugins/nodebb-plugin-emoji-extended/images/grinning.png net::ERR_CONNECTION_REFUSED index.js:153 WebSocket connection to 'ws://forum.sanatisharif.ir/socket.io/?EIO=3&transport=websocket&sid=2Y61E9Zihllh82snAAAD' failed: Establishing a tunnel via proxy server failed. index.js:153 GET http://forum.sanatisharif.ir/vendor/jquery/timeago/locales/jquery.timeago.fa-short.js?_=1449932876822 404 (Not Found)

    Forum Config:

    varnish on port 80, nginx on port 8082, nodebb on port 4567

    varnish config:

    backend forum { .host = "127.0.0.1"; # your nginx host .port = "8082"; # your nginx port .connect_timeout = 600s; .first_byte_timeout = 600s; .between_bytes_timeout = 600s; .max_connections = 100000; } backend nodebb { .host = "127.0.0.1"; # your nodebb host .port = "4567"; # your nodebb port .connect_timeout = 600s; .first_byte_timeout = 600s; .between_bytes_timeout = 600s; .max_connections = 100000; } # Only allow purging from specific IPs acl purge { "localhost"; "127.0.0.1"; } import std; # This function is used when a request is send by a HTTP client (Browser) sub vcl_recv { unset req.http.X-Forwarded-For; set req.http.X-Forwarded-For = client.ip; #pipe websocket connections directly to Node.js if (req.http.upgrade ~ "(?i)websocket" || req.http.Upgrade ~ "(?i)websocket") { set req.backend_hint = nodebb; return (pipe); } # NodeBB forum if (req.http.host ~ "(?i)^(www.)?forum\.sanatisharif\.ir$" || req.http.host ~ "(?i)^(www.)?forum\.sanatisharif\.com$" || req.http.host ~ "(?i)^(www.)?forum\.sanatisharif\.net$" || req.http.host ~ "(?i)^(www.)?forum\.sanatisharif\.org$") { set req.backend_hint = forum; if (req.url ~ "^/socket\.io/") { set req.backend_hint = nodebb; return (pipe); # return pass seems not working for websockets } return (pass); } # Allow purging from ACL if (req.method == "PURGE") { # If not allowed then a error 405 is returned if (!client.ip ~ purge) { return(synth(405, "This IP is not allowed to send PURGE requests.")); } # If allowed, do a cache_lookup -> vlc_hit() or vlc_miss() return (purge); } if (req.http.Authorization || req.http.Cookie || req.method == "POST") { # Not cacheable by default return (pass); } return (hash); } sub vcl_pipe { #Need to copy the upgrade for websockets to work if (req.http.upgrade) { set bereq.http.upgrade = req.http.upgrade; } } # This function is used when a request is sent by our backend (Nginx server) sub vcl_backend_response { # Remove some headers we never want to see unset beresp.http.Server; unset beresp.http.X-Powered-By; # For static content strip all backend cookies if (bereq.url ~ "\.(css|js|png|gif|jp(e?)g)|swf|ico") { unset beresp.http.cookie; } # Only allow cookies to be set if we're in admin area #if (beresp.http.Set-Cookie && bereq.url !~ "^/wp-(login|admin)") { # unset beresp.http.Set-Cookie; #} # don't cache response to posted requests or those with basic auth if ( bereq.method == "POST" || bereq.http.Authorization ) { set beresp.uncacheable = true; set beresp.ttl = 120s; return (deliver); } # don't cache search results if ( bereq.url ~ "\?s=" ){ set beresp.uncacheable = true; set beresp.ttl = 120s; return (deliver); } # A TTL of 24h #set beresp.ttl = 24h; # Define the default grace period to serve cached content #set beresp.grace = 30s; set beresp.grace = 6h; set beresp.ttl = 300m; return (deliver); } sub vcl_backend_error { return (deliver); } sub vcl_synth { return (deliver); }

    nginx config:

    upstream io_nodes { ip_hash; server 127.0.0.1:4567; server 127.0.0.1:4567; } server { listen 127.0.0.1:8082; server_name forum.sanatisharif.ir; root /home/nodeBB/forum/public; port_in_redirect off; access_log off; #home page location = / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://io_nodes; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; try_files $uri $uri/ @proxy; location @proxy{ proxy_pass http://io_nodes; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
  • 0 Votes
    4 Posts
    2k Views

    @julian alright, will keep an eye on that.

    It helps that hiredis is no longer on the package dependency list, I can try to install NodeBB on an Azure website again 😛

  • 0 Votes
    7 Posts
    2k Views

    @julian

    That means I have to update the plugin separately.

    That should not be a problem, but I have to first get NodeBB to work on my site, either from a subfolder or a subdomain. There's too much going on i my head right now that even the smallest problem seems very difficult.

    Perhaps you or anybody reading this can help me figure out why. So as not to hijack this thread, I'm starting another one with my main issue at Nginx 502 Bad Gateway and NodeBB subdomain installation.

  • 0 Votes
    5 Posts
    2k Views

    Well an empty string shouldn't crash

    tag.content = tag.content.replace(/[&<>'"]/g, function(tag) { return escapeList[tag] || tag; });

    Make sure you are on latest on both nodebb and the lavender theme. Are you still getting any crashes?

  • 0 Votes
    4 Posts
    5k Views

    great hint.