我想做这样的事情,所以npm install
还安装了package.json
of ../somelocallib
或者更重要的是它的依赖关系。
"dependencies": {
"express": "*",
"../somelocallib": "*"
}
npm >= 2.0.0
这个功能是实施的 https://docs.npmjs.com/cli/v7/configuring-npm/package-json#local-paths在 npm 2.0.0 版本中。可以使用保存本地路径npm install -S
or npm install --save
,使用以下任何形式:
../foo/bar
~/foo/bar
./foo/bar
/foo/bar
Example package.json
:
{
"name": "baz",
"dependencies": {
"bar": "file:../foo/bar"
}
}
npm ls
:
[email protected] /cdn-cgi/l/email-protection /private/tmp/app
└── [email protected] /cdn-cgi/l/email-protection -> /private/tmp/somelocallib
npm
Put somelocallib
作为你的依赖package.json
像平常一样:
"dependencies": {
"somelocallib": "0.0.x"
}
然后运行npm link ../somelocallib
npm 将安装您正在使用的版本作为符号链接.
参考:link(1) https://docs.npmjs.com/cli/link
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)