Npm install & update makes Editor unresponsive

Hello All! First time posting here so please excuse any wrongdoing or double posting.

I am running into an issue where if I attempt to update packages/Nodes through the windows CMD using either:
npm install
or
npm update
After running either command the Node-Red editor locks up and becomes unresponsive. I believe it is hanging somewhere given that my cursor locks into the last shape, based on what my mouse was hovering over when it becomes unresponsive, but I can't quite put my finger on it.

This happens after I enable the Projects feature and load my project, then run either command for updating packages. I am utilizing UiBuilder so I would like to get @TotallyInformation to share his thoughts, but if I install each package individually through npm or palette manager no problem.

No CMD errors when running node-red
No chrome dev tools console or networking errors
Happens on multiple versions of Node.js and Node-Red on both Mac and PC.

Any thoughts? Please help.

Shouldn't make any difference to the Editor. uibuilder does provide another package manager but that is just for packages that you want uibuilder to make available via ExpressJS to your front-end. You can achieve the same thing by installing packages manually and amending the uibuilder package list file.

One slight thing with uibuilder and Node-RED projects. Currently you have to restart Node-RED if you change projects and are using uibuilder. I have not yet found time to add in the event handling logic to handle live project swaps.

You were absolutely right. UiBuilder had nothing to do with it. I thought it may have been some of the packages it was using.

Turns out an npm install creates a node-modules folder in the projects directory that has 5k+ files that lock up the editor trying to load all of those changes in the git projects tab. Is there a way that I should be trying to load the missing nodes other than the npm install command? Seems like no one has definitively answered this. I am trying to avoid using the palette manager to install all of the dependencies. @TotallyInformation thank you for responding so quickly by the way. I really appreciate it!

You shouldn't be installing nodes in your project directory. You install them in the .node-red directory.

1 Like

And that is true of front-end modules deployed via the uibuilder library manager as well.

Also, what dependencies are you having to install? Do you mean just installing nodes? That is really best done from within the palette manager as it avoids making mistakes.

Okay, I think I do mean installing nodes. I am working with a team on this app and attempting to run our dev-ops such that we can install on new machines without much pain, and if dependencies get updated or require a version change there is a foolproof approach to having the same environment amongst us all. I would assume this should be the same way that I ensure the proper nodes and dependencies for end-user deployment through an npm install. Is it instead the case that the pallet manager is the only true way to get project nodes over to the local install?

Also thank you both for the help. I'm sure you aren't thanked enough especially for such an amazing tool that is free to use. Really appreciate the time that you put in to help people work through their problems!!!

The dependency management of projects is one area that needs more work.

The editor helps you get the project's package.json up to date with the modules your flow is using.

It doesn't yet help you get dependencies installed when an updated package.json is loaded.

There may be some tricks you can do with npm - I haven't tried but I wonder if running:

npm install --prefix ~/.node-red from within the project's directory will do the right thing. I don't know if that would update the package.json in ~/.node-red which may cause issues later on.

I think I figured out a way that will work for the time being. After some testing and multiple Node-Red uninstalls I found that if I run npm install <path for project folder> in the .node-red directory I get all of my nodes installed properly, with the correct versions listed in the project dependencies. For some reason, an npm outdated command will tell me that the packages are still missing but starting up node-red reveals that I have everything I need, no unresponsive editor, no 5k+ git changes, smooth sailing. I will test one more time today and confirm that this runs properly on macOS as well.

Thank you for the help!

P.S.: the <path for project folder> needs to be the location where the package.json is for your current active project. Example: npm install .\.node-red\projects\coolApp