Can I publish a npm package using raw curl or other raw request? #145855
-
Hello I am setting up a remote npm repository using Jfrog Artifactory. My intention is to then forward on and publish the package from Artifactory to the public NPM registry using curl or python request library with an auth token. I am attempting to POST my zipped up package onto https://registry.npmjs.org - is this even possible please? Or do you always have to use the NPM cli? Is there any documentation covering this please? Many thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
CLI is the supported approach. Why do you want to publish via curl? I think, it is easier to invoke npm cli from python and publish it, as the cli does lot of pre-processing before uploading the package. Or may be depend on CI/CD pipelines to automate it, where you can invoke the cli in the automation flow. |
Beta Was this translation helpful? Give feedback.
-
While the npm CLI is the easiest way to publish packages, you can indeed use curl or Python’s requests to interact directly with the npm registry. You need to ensure that the request is correctly formatted, with appropriate headers and package content. If you're planning on automating this, it’s essential to handle error responses and ensure your authentication is secure. |
Beta Was this translation helpful? Give feedback.
It's fixed! Just had to fiddle about with the JSON object!