Problem Installing Node-Red on Windows 11

Hi I'm completely new to node.js, Node-Red and a novice powershell user. I keep getting this error when trying to install and run Node-Red. My User\anyde directory contains a package-lock.json file and I can find Node-Red in "C:\Users\anyde\AppData\Roaming\npm" Any help would be great!

Have you tried opening another PowerShell after the installation? It may be that the current session hasn't picked up the node-red command.

I never use the global install so I don't really know much more, I do know that I can never remember where the npm global installs end up in the filing system so you will need to search for them, find the correct cmd file and make sure that the folder it is in is added to the path environment variable.

Personally, I find it easier to install node-red locally and simply use an npm script defined in the package.json file in the folder I installed node-red to. I also make the userDir a data sub-folder of that same folder so that everything is together in one place and the startup command is always at a known location (c:\src\nr\ in my case :slight_smile: ). As my Windows install is a dev instance, I also use PM2 to control it. Again via npm scripts for simplicity.

Much of this is documented in my alternate node-red installer repo on GitHub.

1 Like

Thanks you, Yes I did try opening another PowerShell, and even restarted my computer. Still the same. So Global install is most likely the problem? I'll search for the files and read your GitHub documentation and see if I can correct this. Can I do local installs on top of the global installs without creating more problems? Thanks again!

Yes, local installs can be done as many times as you like and they are independent of each other. Indeed, that's one of the reasons I started doing them - it enables me to run not only multiple instances (you can do that with a global install) but have them on different versions of Node-RED. But overall, I just like that I always know where everything is without having to trawl through different operating system file structures and I like that I can copy or back up the whole shebang very easily because it is all in one parent folder.

It does require that you understand a little about npm and node.js though. Not a lot but a little.

1 Like

Ok, I followed your documentation and got as far as "alternate-node-red-installer -f " before getting stuck. I created a folder in my user directory and tried to set the root to that folder, but got the error attached below. I tried both absolute and relative path, but I'm obviously missing something. I manually searched for the npm folder, found it in AppData > Roaming, and was able to launch node-red from the node-red.cmd file. I got it running but I imagine this didn't solve the "global install" issue you were trying to help me with. I did notice that your alternate-installer was also in the npm folder at "C:\Users\anyde\AppData\Roaming\npm\node_modules\alternate-node-red-installer" I can start learning the basics now that I can launch it, but any further advice on setting this up properly would be great. It could be that I just don't understand using the command line well enough. Thanks so much for your help again.

OK, well what this does show is that there is a problem with your node.js installation. You clearly don't have the correct folders added to the path environment variable.

It may be sensible for you to reinstall the Windows version of node.js from the official website. Also make sure that you can type node in PowerShell - it should open up a node.js REPL.

1 Like

Sounds daunting but I'm sure your right. Node looks like it's working ok. but I get errors whenever trying to find Node-Red from PowerShell. I'll reinstall. Thanks again for all your help. Would you recommend using nvm?

nvm is NOT recommended for normal Node-RED installs - it's always recommended to not use it at all

1 Like

Great, thanks for the advice. Will avoid it then.

I reinstalled Node.js as you suggested and was able to use your alternate installer for Node-Red. Everything works great now. Thank for all your help and the installer!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.