Cannot find module [..] my-theme/less/app.js

Technical Support
  • Hello! I was in the middle of making adjustments to my custom theme's LESS files, when all of a sudden, restarting Nodebb failed and I can't seem to start it. My nodebb logs say,

    Error: Cannot find module '/var/www/html/forum/nodebb/node_modules/nodebb-theme-mine/less/app.js'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.runMain (module.js:607:10)
    at run (bootstrap_node.js:382:7)
    at startup (bootstrap_node.js:137:9)
    at bootstrap_node.js:497:3
    3 restarts in 10 seconds, most likely an error on startup. Halting.
    

    When I attempt to start nodebb, it hangs with the following output:

    [email protected]:/var/www/html/forum/nodebb/node_modules/nodebb-theme-mine/less# /var/www/html/forum/nodebb/nodebb start
    
    Starting NodeBB
      "./nodebb stop" to stop the NodeBB server
      "./nodebb log" to view server output
      "./nodebb restart" to restart NodeBB
    
    [email protected]:/var/www/html/forum/nodebb/node_modules/nodebb-theme-mine/less# (node:17963)     DeprecationWarning: Calling an asynchronous function without callback is deprecated.
    

    At first, I thought perhaps it was an error in my LESS file, and in fact I did find and correct an error, but it didn't fix the problem. Any suggestions?

    Thanks,
    Bret

  • Can you post your plugin.json file?

  • Sure thing! Here is my plugin.json:

    {
        "id": "nodebb-theme-2600hz",
        "library": "./lib/theme.js",
        "hooks": [
    	   {
    	     "hook": "filter:widgets.getAreas", "method": "defineWidgetAreas"
    	   }
        ],
        "scripts": [
    	   "lib/2600hz.js"
        ]
    }
    

    My theme name is nodebb-theme-2600hz. (I rewrote it in my original question.) Also, I verified that both 2600hz.js and theme.js both exist.

  • @Bret did you run "./nodebb build" after changing your theme?

    You may also benefit from using grunt as part of your workflow, as then NodeBB will automatically restart on file changes 😄

  • @julian

    Is there a "build" command for nodebb? When I try to run that, I get:

    Welcome to NodeBB

    Usage: ./nodebb {start|stop|reload|restart|log|setup|reset|upgrade|dev}
    
      start	Start the NodeBB server
      stop	Stops the NodeBB server
      reload	Restarts NodeBB
      restart	Restarts NodeBB
      log	Opens the logging interface (useful for debugging)
      setup	Runs the NodeBB setup script
      reset	Disables all plugins, restores the default theme.
      activate	Activate a plugin on start up.
      plugins	List all plugins that have been installed.
      upgrade	Run NodeBB upgrade scripts, ensure packages are up-to-date
      dev	Start NodeBB in interactive development mode
    

    Cheers,
    Bret

  • Ah nevermind, then it could be that you're not running v1.4.0 😄 Carry on...

  • No worries, back to square one then, any suggestions? Would upgrading to 1.4 solve this issue? I'm currently on 1.2.1.

    Thanks,
    Bret

  • @Bret certainly wouldn't hurt to try 😄

    Back up your db though!


Suggested Topics