Reputation: 764
I'm building custom nodes for a Node-RED app (http://nodered.org/) and published each one as a private NPM module and put them in my package.json like this:
"@di-dash/node-red-contrib-didash-output": "0.0.1",
but that makes them install inside of a parent directory like this:
/node_modules/@di-dash/node-red-contrib-didash-output
The fact that they're in a parent directory now instead of directly in the node_modules directory like they were when I was just pulling in github repos as depencencies prevents Node-RED from noticing them and including them in the app.
I wrote a grunt script to pull them out of the parent directory and put them directly into node_modules and put it as a "postinstall" script in package.json but that must happen after the app inits because the Node-RED app isn't picking up my custom nodes anymore.
Any ideas how to make the private modules install without a parent directory so that they're just like normal (non-private) NPM modules?
Like this:
node_modules/node-red-contrib-didash-output
Instead of:
/node_modules/@di-dash/node-red-contrib-didash-output
Upvotes: 1
Views: 283
Reputation: 59213
It's not that they are private modules, it's that they are scoped modules. They are supposed to be in a directory with the same name as the scope they are under. The only way to make them install in root is by removing the scope from the packages. I suggest seeking support from the Node-RED team to see if they have a workaround for scoped modules.
Edit: I took the liberty of opening an issue for you :)
https://github.com/node-red/node-red/issues/885
Upvotes: 2