admin管理员组文章数量:1406217
I have a npm dependency installed from a local path, which in turn has a few dependencies of its own. As I understand it, in this case npm just copies the contents of the local folder under node_modules. Is there any way to make it run npm install on the package folder before copying it?
I have a npm dependency installed from a local path, which in turn has a few dependencies of its own. As I understand it, in this case npm just copies the contents of the local folder under node_modules. Is there any way to make it run npm install on the package folder before copying it?
Share Improve this question asked Nov 23, 2016 at 21:20 OrgrimOrgrim 3571 gold badge5 silver badges13 bronze badges 1- Does this answer your question? how to specify local modules as npm package dependencies – Inigo Commented May 22, 2020 at 17:10
1 Answer
Reset to default 4npm install /path/to/foo
simply copies from the specified path into your local package's node_modules
folder. If this is what you meant by "installed from a local path", then that was the wrong thing to do if you want to make sure that npm update
and npm install
on your package would (a) automatically get the latest code from that path and (b) update/install the dependencies of the package at that path.
To acplish (a) and (b), you can add that local dependency to your package.json
's dependencies
or devDependencies
(supported by npm since 2.0). For example:
"dependencies": {
"foo": "file:/path/to/foo"
}
After doing the above, npm update
or npm install
will treat that local dependency in the same way as any other dependency.
本文标签: javascriptInstall npm local package dependenciesStack Overflow
版权声明:本文标题:javascript - Install npm local package dependencies - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744994459a2636585.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论