Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support scoped modules #885

Closed
catdadcode opened this issue May 5, 2016 · 6 comments
Closed

Support scoped modules #885

catdadcode opened this issue May 5, 2016 · 6 comments

Comments

@catdadcode
Copy link

catdadcode commented May 5, 2016

Node-red doesn't appear to have the ability to pick up scoped modules installed to $HOME/.node-redwhich are installed with a parent directory named after the module scope (i.e. node_modules/@myscope/my-node instead of just node_modules/my-node). Are there any workarounds for nodes that are published to private registries under a package scope? Would it be possible to modify the lookup code to peek inside any directories beginning with @ and include nodes found in there?

@knolleary knolleary changed the title node-red is supposed to pick up modules installed to $HOME/.node-red but doesn't seem to support scoped modules. Support scoped modules May 6, 2016
knolleary added a commit that referenced this issue May 6, 2016
@mbayfield
Copy link

A workaround we used for scoped modules was to have node-red embedded into an express app, then pass the "nodesDir" setting pointing to the installed node_modules/@scope folder, when doing RED.init(server,settings). All the nodes are then installed through the package.json of the express app.
http://nodered.org/docs/embedding

@biancode
Copy link
Contributor

tried out 0.14.0 branch and get TypeError with installed scoped package - package works fine without scope in name of package.json - did I need some more to configure in the package.json?

TypeError: Cannot read property 'nodes' of undefined
at Object.getAllNodeConfigs as getNodeConfigs
at module.exports.getAll (/node-red/red/api/nodes.js:39:31)
at Layer.handle as handle_request
at next (/node-red/node_modules/express/lib/router/route.js:131:13)
at /node-red/red/api/auth/index.js:63:13
at Layer.handle as handle_request
at next (/node-red/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/node-red/node_modules/express/lib/router/route.js:112:3)
at Layer.handle as handle_request
at /node-red/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/node-red/node_modules/express/lib/router/index.js:330:12)
at next (/node-red/node_modules/express/lib/router/index.js:271:10)
at urlencodedParser (/node-red/node_modules/body-parser/lib/types/urlencoded.js:88:40)
at Layer.handle as handle_request
at trim_prefix (/node-red/node_modules/express/lib/router/index.js:312:13)
at /node-red/node_modules/express/lib/router/index.js:280:7

@knolleary
Copy link
Member

Ah... you found a deficiency in my testing. Will take another look.

@knolleary
Copy link
Member

With this commit 9e26aee the 0.14.0 branch should now properly handle scoped modules

@biancode
Copy link
Contributor

biancode commented May 17, 2016

very well - Thank you! It works.

@knolleary knolleary added this to the Current milestone May 17, 2016
@knolleary knolleary modified the milestone: Current Aug 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants