[SOLVED] NodeBB Fresh install - Several Issues ( Upload/Dev Mode/Rebuild-Restart Disabled)

Technical Support
  • Hello everyone,

    I am having a couple issues after installing nodebb which I do not know how to fix. I dont particulary like asking help on forums as the hard lesson is usually the best lesson. This time however I have no clue how to fix the below issues. At first I thought about privileges, couldnt upload and development mode because admin.js was missing from the re-captcha plugin but after trying all sorts of things I still am unable to resolve the issue.

    So, in the meanwhile I will await any responce so I can start digging again and hopefully fix these issues. Thanks a lot in advance!

    Issues

    • Dashboard says: "Rebuilding and
      Restarting your NodeBB has been disabled as you do not seem to be running it via the appropriate daemon."
    • Notices: Forum is running in development mode. The forum may be open to potential vulnerabilities; please contact your system administrator. ( FIXED - Read Bottom page )
    • Uploading Profile Picture: Looks like your connection to Forum has been lost, please wait while we try to reconnect.

    General Information:

    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_set_header Upgrade         $http_upgrade;
        proxy_set_header Connection      "upgrade";
        proxy_redirect                   off;
        proxy_http_version               1.1;
        proxy_pass                       http://127.0.0.1:4567;
    }
    
    • Config.json:
    {
        "url": "https://forum.dregora.com",
        "port": "4567",
        "secret": "xxx-xxx-xxx-xxx-xxx",
        "database": "mongo",
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "nodebb",
            "password": "xxx",
            "database": "nodebb",
            "uri": ""
        }
    }
    

    Attempts to Resolve

    • Clearing Buffered Webcontent & Cookies after each attempt + Trying to upload profile picture & checking issues. Each issue confirmed present after each attempt
    • npm update
    • Reinstall Monodb-org
    • Reinstall nodebb
    • chown 777 test on /uploads
    • ./nodebb upgrade
    • ./nodebb build + restart
    5. Rebuilding assets...  started
    2018-10-23T11:14:21.073Z [8729] - warn: [plugins] File not found: /var/www/vhosts/dregora.com/forum.dregora.com/node_modules/nodebb-plugin-math-captcha/public/js/admin.js (Ignoring)
    2018-10-23T11:14:21.117Z [8729] - info: [build] Building in parallel mode
    2018-10-23T11:14:21.121Z [8729] - info: [build]         plugin static dirs  build started
    2018-10-23T11:14:21.133Z [8729] - info: [build]          requirejs modules  build started
    2018-10-23T11:14:21.139Z [8729] - info: [build]           client js bundle  build started
    2018-10-23T11:14:21.146Z [8729] - info: [build]            admin js bundle  build started
    2018-10-23T11:14:21.148Z [8729] - info: [build]         client side styles  build started
    2018-10-23T11:14:21.152Z [8729] - info: [build] admin control panel styles  build started
    2018-10-23T11:14:21.157Z [8729] - info: [build]                  templates  build started
    2018-10-23T11:14:21.160Z [8729] - info: [build]                  languages  build started
    2018-10-23T11:14:21.162Z [8729] - info: [build]                     sounds  build started
    2018-10-23T11:14:51.121Z [8729] - info: [build]         plugin static dirs  build completed in 30.001sec
    2018-10-23T11:14:51.683Z [8729] - info: [build]           client js bundle  build completed in 30.544sec
    2018-10-23T11:14:51.826Z [8729] - info: [build]            admin js bundle  build completed in 30.68sec
    2018-10-23T11:14:52.063Z [8729] - info: [build] admin control panel styles  build completed in 30.911sec
    2018-10-23T11:14:52.094Z [8729] - info: [build]                     sounds  build completed in 30.932sec
    2018-10-23T11:15:05.624Z [8729] - info: [build]         client side styles  build completed in 44.476sec
    2018-10-23T11:15:48.524Z [8729] - info: [build]          requirejs modules  build completed in 87.391sec
    2018-10-23T11:17:07.543Z [8729] - info: [build]                  languages  build completed in 166.384sec
    2018-10-23T11:17:49.202Z [8729] - info: [build]                  templates  build completed in 208.045sec
    2018-10-23T11:17:49.205Z [8729] - info: [build] Asset compilation successful. Completed in 208.086sec.
    
    • Remove plugin re-captcha ( admin.js missing )
    • Nodebb install ( I found myself doing random things at this point ) which gives the following error ( probably since the nodebb already has been configured? + Google Search "[bench press js] Unable to build or find a suitable native module" Didnt gave much information on how to fix this)
    [root@dregora forum.dregora.com]# ./nodebb stop
    Stopping NodeBB. Goodbye!
    [root@dregora forum.dregora.com]# ./nodebb install
    [benchpressjs] Unable to build or find a suitable native module, falling back to JS version
    2018-10-23T12:26:46.613Z [18606] - info: Launching web installer on port 4567
    events.js:160
          throw er; // Unhandled 'error' event
          ^
    
    Error: listen EADDRINUSE :::4567
        at Object.exports._errnoException (util.js:1020:11)
        at exports._exceptionWithHostPort (util.js:1043:20)
        at Server._listen2 (net.js:1271:14)
        at listen (net.js:1307:10)
        at Server.listen (net.js:1403:5)
        at EventEmitter.listen (/var/www/vhosts/dregora.com/forum.dregora.com/node_modules/express/lib/application.js:618:24)
        at launchExpress (/var/www/vhosts/dregora.com/forum.dregora.com/install/web.js:75:15)
        at /var/www/vhosts/dregora.com/forum.dregora.com/install/web.js:69:3
        at /var/www/vhosts/dregora.com/forum.dregora.com/node_modules/async/dist/async.js:3888:9
        at /var/www/vhosts/dregora.com/forum.dregora.com/node_modules/async/dist/async.js:473:16
    [root@dregora forum.dregora.com]#
    /
    

    I hope I gave enough information to give an idea of what is going on, if not please let me know.

    Update/current state

    • After trying different websockets nginx configurations I couldnt log in anymore until I completely erased the websocket directives.
    • Development mode was changed to production through the node.js in plesk.
    • Trying to add websockets causes session issue: ( With or Without passing proxy to apache through plesk )
    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_set_header Upgrade         $http_upgrade;
    	proxy_set_header Connection      "upgrade";
    	proxy_redirect                   off;
    	proxy_http_version               1.1;
    	proxy_pass                       http://127.0.0.1:4567;
    }
    
  • You need to kill all NodeBB processes, then start it with ./nodebb start. You need to make sure the URL value in config.json is equal to the url at which you access your site. You need to look at docs.nodebb.org for nginx instructions. I don't think anybody here knows anything about plex, I suggest avoiding it until you get things working manually.

  • It feels like there are several things going on. I would at least check the following two things:

    1. Is there perhaps still a rogue process running of NodeBB? This might explain the EADDRINUSE. And probably why it says it is running in dev mode, since it might be a dev process running in the background from earlier testing?
    2. You can find up-to-date Nginx configurations in the documentation: https://docs.nodebb.org/installing/os/ubuntu/#configuring-nginx
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
    
        proxy_pass http://127.0.0.1:4567;
        proxy_redirect off;
    
        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    

    Take also note of the different location configuration. You're doing an unnecessary regular expression check, which might actually break in some circumstances.

    You can ignore the warning for the missing admin.js. But that isn't the re-captcha plugin. That is the math-captcha plugin. An update should be out soonish that will fix this warning.

  • Hello everyone,

    It's been a while since I took a look at the nodebb forum setup as I've had my exams. As of today I am however finished which means more time to focus & fix these issues.

    So, for starters I have fixed some permission issues and have a secure forum while being able to upload files to the upload folder. However I am still not able to upload a profile picture. After spending the amount of time I did i am starting to suspect the software itself which brings me to the following. I can't automatically update nodebb using the rebuild & restart option on the forums.

    This is the error it displays: Rebuilding and Restarting your NodeBB has been disabled as you do not seem to be running it via the appropriate daemon.

    @PitaJ

    As for plex, it's a hosting software package which lets you manage everything the easy way like installing ngnix/apache with the click of a button. Before I started using this I only used a terminal + ftp which in fact I have been using to install nodebb.

    @Dravere

    I have fixed the EADDRINUSE as well as the dev mode. I really do wonder how there could have been two instances. Confirming through listing the ports being listened on I do know that this issue has been fixed now though. I have tried setting the nginx directives in the vhosts through plesk ( i usually did this through apache vhosts without plesk ) but this caused everything to break down ( either proxy_pass or location / was not allowed for some reason I do not understand )
    I do have to say that I've made sure to make backups after the #update!

    #Update
    The start of this reply was made about 7 hours ago. I've had my breaks but other then that I've attempted 3-reinstalls of nodebb from which there was one success. This was to make sure i am running the latest nodebb. Sadly the same issues persist. No restart/rebuild possible and no avatar uploads possible ( regular uploads are possible through the admin menu though )

    P.S. This is not nearly my first couple setbacks, I've went through the same when my server's HDD got corrupted and I had no backups + when I attempted & eventually succeeded setting up a fully working mailserver ( which even finds it's way into outlook mailboxes ) So do know that I appreciate the help a ton and that any help is not getting to waste!

    #Note
    Given the re-install I did learned more then I knew previously, simple yet effective things like ./nodebb dev and log ( as well as how much things could possibly go wrong with npm )

    #UPDATE 2 - Somehow rebuild and restart using the fancy button does work? Now i am confused
    Naamloos.jpg

    The startup contains this by the way:

    Restricting access to origin: https://forum.dregora.com:*
    

    Config:

    {
        "url": "https://forum.dregora.com",
        "secret": "xxx-xxx-xxx-xxx",
        "database": "mongo",
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "xxxxx",
            "password": "xxxxx",
            "database": "xxxxx",
            "uri": ""
        }
    
  • There was a typo in the proxy settings which are fixed now. However, the issue where I can not upload profile pictures or to a topic still remains. I continued looking and found this:

    2019-01-07T15:42:10.830Z [4567/12991] - error: Cannot call write after a stream was destroyed
    Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
        at doWrite (_stream_writable.js:411:19)
        at writeOrBuffer (_stream_writable.js:399:5)
        at WriteStream.Writable.write (_stream_writable.js:299:11)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:201:24)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
        at Socket.<anonymous> (/var/www/vhosts/dregora.com/forum.dregora.com/src/logger.js:205:12)
    

    067b6930-5973-475d-b4e9-8863bb5fef93-afbeelding.png
    I also noticed the log isnt written to the notebb.log under /nodebbrootfolder/logs/nodebb.log ( even with permission 666 configured.

    From my understanding this points to winston, but i have no clue how to proceed now.

  • Solved!

    Soo, there appeared to be two errors. One with the nginx config which I solved in the past ( a / typo behind the proxy_pass ) for anyone having this same issue make sure you double check the nginx rules for a typo.

    Secondly a npm rebuild fixed all the issues.

    Thanks for the help guys!


Suggested Topics