npm >= 2.0.0
This feature was implemented in the version 2.0.0 of npm. Local paths can be saved using npm install -S
or npm install --save
, using any of these forms:
../foo/bar
~/foo/bar
./foo/bar
/foo/bar
Example package.json
:
{
"name": "baz",
"dependencies": {
"bar": "file:../foo/bar"
}
}
npm ls
:
[email protected] /private/tmp/app
└── [email protected] -> /private/tmp/somelocallib
npm < 2.0.0
Put somelocallib
as dependency in your package.json
as normal:
"dependencies": {
"somelocallib": "0.0.x"
}
Then run npm link ../somelocallib
and npm will install the version you’re working on as a symlink.
Reference: link(1)