Node-RED not recognizing npm on alternate Node.js installation

#1

Hello!

I am curious about the functionality of Node-RED when handling a REST call. I have a bundled version of Node.js that is zipped and has Node-RED installed with it. This means that I do not have the typical Node.js install on my machine. If I try to make a REST call to a Node-RED server to install a custom node with this type of installation, I get an error trying to resolve npm:

[warn] 'npm.cmd' is not recognized as an internal or external command,
operable program or batch file.

Now, I know why this is happening. Once I add the path to npm in my system environment PATH variable, this error will go away and the node installation will work correctly. After looking in the source code of Node-RED I figured that the only way Node-RED knows where npm is, is by getting it from there. First of all, is this thinking correct? And second, is there a way to get Node-RED to be able to use npm (which I remind you, is packaged with my bundled Node.js) without relying on it being added to PATH?

EDIT: To add to this, I also assume the reason Node-RED would work this way is that a typical Node.js installation automatically adds npm to the PATH variable when it gets installed.

0 Likes

#2

I think you are correct - we do assume npm is available the the environment, as indeed we do for node itself (and git if you use projects)

0 Likes