I am trying to compile a nodejs project , with VS2015.
The main project has sub projects in sub folders, that is to say that in each sub-folder there is one package.json
with its own code and each one declares the dependencies to the other projects.
The problem I have is that when I try to run any example from the main project, instead of using the packages from the sub-folders, it downloads all the packages from the npm registry .
My question is: How can I configure visual studio to use the code of the sub-projects without downloading the packages from the internet?
The functionality you are looking for is provided by npm-link which allows you to symlink a package's source code so you can debug it without going crazy. (This article in English is very interesting: npm link: developing your own npm modules without tears )
The way to use it in your case would be the following:
npm link
npm link subproyecto1
...npm link subproyectoN
I have made a test with Visual Studio 2015 creating a solution with two projects
nodejs - projectdeps-main package.json file
nodejs - projectdeps-module1 package.json file
Then I have executed
npm link
in the project cardnodejs-projectdeps-module1
with the following result:Then I have executed
npm link nodejs-projectdeps-module1
in the project foldernodejs-projectdeps-main
and the result has been:This is how the solution looks in Visual Studio 2015 showing the dependencies between packages:
Update : The source code of the tests I have performed is published on GitHub
You can specify in your file
package.json
the dependency to a local repository instead of specifying the version.For example :
More information at: package.json - Local Paths