Download a package from npm as a tar (not installing it to a module)

前端 未结 5 892
滥情空心
滥情空心 2021-01-30 06:18

Is there some URL from which I can download a given package from npm (as a tarball or something)? I need the exact files that were originally uploaded to npm.

Using

5条回答
  •  一个人的身影
    2021-01-30 07:00

    If you need to get the tarball without having npm installed, you can fetch the package information using curl and use jq to get the right information from the JSON:

    curl https://registry.npmjs.org/PACKAGE-NAME/ \
        | jq '.versions[."dist-tags".latest].dist.tarball'
    

    This is for instance useful if you're building a Docker container that requires one npm package, and don't want to install npm just for that.

提交回复
热议问题