npm 把 somelocallib 作为你的 package.json 中的依赖项照常:依赖关系":{somelocallib":0.0.x";}然后运行 npm link ../somelocallib,npm 将安装您正在使用的版本作为符号链接[email protected]/private/tmp/app└── [email protected] ->/private/tmp/somelocallib参考:link(1)I want to do something like this, so npm install also installs the package.json of ../somelocallib or more importantly its dependencies."dependencies": { "express": "*", "../somelocallib": "*"} 解决方案 npm >= 2.0.0This 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/barThe local package will be copied to the prefix (./node-modules).npm < 2.0.0Put 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 [email protected] /private/tmp/app└── [email protected] -> /private/tmp/somelocallibReference: link(1) 这篇关于package.json 中的本地依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 阿里云证书,YYDS! 05-22 10:19