admin管理员组文章数量:1178539
Is there a way I can download an npm package without having to do a npm view XXX ...
or basically just not having to install node/npm? I'm trying to do this on a linux machine.
~EDIT~ I realize I should've added some clarification on what I'm trying to achieve here: all I need are the package's files with dependencies to be served as a static resource on cloudfront. I'm hoping npm provides a way to directly download the artefact like the way maven-central does.
Is there a way I can download an npm package without having to do a npm view XXX ...
or basically just not having to install node/npm? I'm trying to do this on a linux machine.
~EDIT~ I realize I should've added some clarification on what I'm trying to achieve here: all I need are the package's files with dependencies to be served as a static resource on cloudfront. I'm hoping npm provides a way to directly download the artefact like the way maven-central does.
Share Improve this question edited Jun 19, 2018 at 17:42 ravenblizzard asked Jun 19, 2018 at 17:07 ravenblizzardravenblizzard 3861 gold badge3 silver badges12 bronze badges 3- 1 Yes, you can do that. No, you should not do that. What's the constraint that you can't install npm? – Jared Smith Commented Jun 19, 2018 at 17:20
- 1 Most npm packages are hosted on github - just visit the corresponding repositorsy and download the zip. – connexo Commented Jun 19, 2018 at 17:26
- @connexo They don't have a release artefact on their GitHub page. All I'm trying to do is to fetch sources (with dependencies) and serve as a static resource on cloudfront. I was just hoping npm provides a way to directly download the artefact like the way maven does. – ravenblizzard Commented Jun 19, 2018 at 17:31
2 Answers
Reset to default 42You can access to the raw package using the NPM api.
https://registry.npmjs.org/{package-name}/{version}
The url above will give you a JSON response containing the package metadata. The package property dist.tarball
contains an url where the package can be downloaded.
Keep in mind you have to install the dependencies of the package on your own
Example:
https://registry.npmjs.org/lodash/4.17.10
NPM API documentation
Download lib folder from github.com-get all files within it
Put all the files next to your node application in the same folder. at the top of your file append it like sooo....
var "" = require("./""")
本文标签: javascriptDownload npm dist package without having to install npmStack Overflow
版权声明:本文标题:javascript - Download npm dist package without having to install npm - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738061330a2057164.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论