From inside your custom node path?
Dont do that.
Because you did npm install mqtt -g
You should simply...
- Setup your custom nodes project folder with necessary files (package.json, your-node.js, your-node.html)
- For any module that is required by your contrib node, from the base path of your custom node (e.g.
C:\my-projects\my-contrib-node
) install the requires usingnpm -i mqtt
(or whatever) - Ensure your project folder has a
.gitignore
file and excludenode_modules
etc
Once project is ready to test, in your node-red folder (e.g. cd c:\users\JSHR\.node-red
), install your node...
npm install C:/my-projects/my-contrib-node
Restart node-red after every change to your source.
From that point on, C:/my-projects\my-contrib-node
will be sym-linked to c:\users\JSHR\.node-red\node_modules\my-contrib-node
. That means any files you change/delete in c:\users\JSHR\.node-red\node_modules\my-contrib-node
will be changed/deleted from C:/my-projects\my-contrib-node
alternatively, if you want step debug in vscode - follow this