npm >= 2.0.0
This feature was implemented in the version 2.0.0 of npm. Example:
{
"name": "baz",
"dependencies": {
"bar": "file:../foo/bar"
}
}
Any of the following paths are also valid:
../foo/bar
~/foo/bar
./foo/bar
/foo/bar
The local package will be copied to the prefix (./node-modules
).
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.
[email protected] /private/tmp/app
└── [email protected] -> /private/tmp/somelocallib
Reference: link(1)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…