Palette manager failing to install under IIS

Hi all,

I've been using Node-RED for a while now wrapped as a Windows service with NSSM, but due to Windows updates sometimes deleting the service, I've been attempting to host it on IIS. Everything went more or less ok until it came to the palette manager. It didn't show up until I realised NPM wasn't on the IIS user's path. After that there was a permissions issue with trying write npm-cache under the appdata directory of the admin account that installed node. I fixed that with an environment variable, but now I have a new error from the palette manager install.

Clicking 'View Log', everything looks ok:

-----------------------------------------------------------
2022-01-06T02:36:49.465Z Install : node-red-dashboard 3.1.3

2022-01-06T02:36:49.469Z npm.cmd install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-dashboard@3.1.3
2022-01-06T02:36:50.552Z [out] 
2022-01-06T02:36:50.552Z [out] up to date in 450ms
2022-01-06T02:36:50.562Z rc=0

The log file is the only indication that something went awry:

6 Jan 01:35:24 - [info] 

Welcome to Node-RED
===================

6 Jan 01:35:24 - [info] Node-RED version: v2.1.4
6 Jan 01:35:24 - [info] Node.js  version: v16.13.1
6 Jan 01:35:24 - [info] Windows_NT 10.0.17763 x64 LE
6 Jan 01:35:25 - [info] Loading palette nodes
6 Jan 01:35:26 - [info] Settings file  : C:\inetpub\wwwroot\Node-RED\settings.js
6 Jan 01:35:26 - [info] Context store  : 'default' [module=memory]
6 Jan 01:35:26 - [info] User directory : .node-red/
6 Jan 01:35:26 - [info] Projects directory: C:\inetpub\wwwroot\Node-RED\.node-red\projects
6 Jan 01:35:26 - [info] Server now running at http://127.0.0.1:8110/
6 Jan 01:35:26 - [info] Active project : Studio-2
6 Jan 01:35:26 - [info] Flows file     : C:\inetpub\wwwroot\Node-RED\.node-red\projects\Studio-2\flows.json
6 Jan 01:35:26 - [info] Starting flows
6 Jan 01:35:26 - [info] Started flows
6 Jan 01:35:41 - [info] Installing module: node-red-dashboard, version: 3.1.3
6 Jan 01:35:43 - [info] Installed module: node-red-dashboard
6 Jan 01:35:43 - [warn] Installation of module node-red-dashboard failed:
6 Jan 01:35:43 - [warn] ------------------------------------------
6 Jan 01:35:43 - [warn] undefined
6 Jan 01:35:43 - [warn] ------------------------------------------
Error: Install failed
    at C:\inetpub\wwwroot\Node-RED\node_modules\node-red\node_modules\@node-red\registry\lib\installer.js:245:25
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
6 Jan 01:35:43 - [error] Error: Install failed

The 'undefined' was coming from the log.warn(output); in 'registry\lib\installer.js', so I replaced it with log.warn(err.stack); and got this back:

6 Jan 02:36:50 - [warn] ------------------------------------------
6 Jan 02:36:50 - [warn] Error: Cannot find module 'node-red-dashboard'
    at Object.getModuleFiles (C:\inetpub\wwwroot\Node-RED\node_modules\node-red\node_modules\@node-red\registry\lib\localfilesystem.js:394:19)
    at Object.addModule (C:\inetpub\wwwroot\Node-RED\node_modules\node-red\node_modules\@node-red\registry\lib\loader.js:493:41)
    at Object.addModule (C:\inetpub\wwwroot\Node-RED\node_modules\node-red\node_modules\@node-red\registry\lib\index.js:63:19)
    at C:\inetpub\wwwroot\Node-RED\node_modules\node-red\node_modules\@node-red\registry\lib\installer.js:207:43
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
6 Jan 02:36:50 - [warn] ------------------------------------------

As far as I can see, there's an intact-looking node-red-dashboard directory and files in node_modules in the userDir, and the permissions look ok to me (owned by the relevant IIS user). So I'm at a bit of a loss as to why it's not finding it. Hope someone can help me chase this down.

I just noticed the log reporting the server is listening on port 8110. I've been serving from port 80 for the time being, and there's nothing on 8110 in the browser. I'm guessing this probably doesn't have anything to do with my issue, but thought I'd point it out now I've seen it, just in case I've done something stupid.

Not sure about this but I know that there is a plugin for IIS that manages node.js apps - Microsoft use it on their web app service. Can't remember the name but should be easy enough to find. Maybe that will help. It does what a service controller would otherwise do as well in that it makes sure that the app is running and responding.