I know how to make an NPM dependency from a GitHub release :
"dependencies": {
"package-name": "user/repo#v1.0.0"
}
That's nice, but I want to install a specific binary from this release.
I tried
"dependencies": {
"package-name": "https://github.com/user/repo/releases/download/v1.0.0/bin.tgz"
}
But I gives me the following error :
❯ npm install
npm ERR! fetch failed https://github.com/user/repo/releases/download/v1.0.0/bin.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
Binary release assets exist outside of GitHub and are using AWS S3.
The URL github.com/user/repo/releases/download/v1.0.0/bin.tgz
is redirecting with a 302
status and a HTTP location header set to https://github-cloud.s3.amazonaws.com/releases/XXX/XXX...
If I try directly with the S3 URL I got a ENAMETOOLONG error (see NPM issue) :
> npm install https://github-cloud.s3.amazonaws.com/releases/XXX/XXX...
npm ERR! tarball.destroy is not a function
npm WARN retry will retry, error on last attempt: Error: ENAMETOOLONG: name too long, open '/var/folders/pn/......
Questions :
404
?My context and needs :
Related
To npm install a public project that is hosted on Github, and not the NPM registry, add the Github repo to package. json dependencies using the username/repo#branch-name format. Run npm install and npm will download the project and save it into your /node_modules/ folder.
NPM installs devDependencies within the package. json file. The 'npm install' command should add all the dependencies and devDependencies automatically during installation. If you need to add specific devDependencies to your project, you can use this command- 'npm install --save-dev'.
I don't think npm provides a way to do this as per their documentation, they support using github's tarballs but not a specific binary attached to a release. https://docs.npmjs.com/cli/install The only way I see it would work is downloading the file and using the "tarball file" way described in the "npm install" docs.
I'm in the same boat and I think I'll end up using npm private repositories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With