How to get a tarball from npm for the Node agent

  • Updated

Objective

How to download a tarball file for the Node agent.

Process

  1. Run npm view @contrast/agent dist.tarball
  2. That command will generate a URL you can paste in a browser to download the tgz file of the <latest> Node.js agent

    For example:
    ❯ npm view @contrast/agent dist.tarball
    https://registry.npmjs.org/@contrast/agent/-/agent-4.24.2.tgz

 

Alternate approach

If you need to get the tarball without having npm installed, you can fetch the package information using curl and jq to get the right information from the JSON. This is for instance useful if you're building a Docker container that requires one npm package, and you don't want to install npm just for that.

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

 

For example:

❯ curl https://registry.npmjs.org/@contrast/agent/ | jq '.versions[."dist-tags".latest].dist.tarball'
"https://registry.npmjs.org/@contrast/agent/-/agent-4.24.2.tgz"

 

Reference

https://stackoverflow.com/a/51318312 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request