Project specific dependencies


When using Node-RED project, I found that the project folder under userDir also has a package.json file.

When I add the dependency to the project from the editor, this file is also updated with the dependency.

However, such dependencies do not seem to be used as there is no node_modules under that specific project.

Is this a feature or a bug?

Like, do we target project specific dependencies - the dependencies/modules that are only loaded for a specific project (to be installed at projects//node_modules), or all projects share the runtime's dependencies (under userDir/node_modules)?



The only nodes that get loaded are those found in userDir/node_modules. This is managed by userDir/package.json. For a flow to run, whether its a standalone flow or a Project, all of its dependencies must be installed there.

A project uses its own package.json to record what modules it depends on. This means if you share the project with another user, they will know what additional modules it requires. When they get installed, they are still installed in userDir/node_modules with all of the other runtime modules.

It also means, with a couple small changes to your package file, you can git clone a project, run npm install and then npm start and your flows will be running. This idea of making a project a standalone, deployable application is one of the key use cases for projects.

There's more work to be done to streamline some of this workflow - but in absence of anyone else contributing to make these improvements, they are sat behind lots of other higher priority items in the roadmap.

1 Like

@knolleary, could you be a bit more specific? What changes are needed in the package file(s)? Is that userDir/package.json, the project package.json or both? I have a project running on my development machine that I would like to move to a production machine where I would rather run it on its own, not as a project. Will that complicate things?

Related: is the project feature still considered beta? Is the file structure under userDir/projects likely to change? Please feel free to tell me that this is all in the documentation somewhere that I missed.


Hi @drmibell

The changes are all in the projects own package.json. You need to add two things:

  1. add node-red as a dependency so it gets installed along side the project
  2. add a start command to run it

This blog post covers the details (although covers a lot more besides) -

1 Like

Thanks! Thanks! (Post must be at least 9 characters. Haven't we been here before?)