# Uploading Artifacts using shell commands

**URL:** <https://community.sonatype.com/t/uploading-artifacts-using-shell-commands/772>\
**Category:** Sonatype Nexus Repository\
**Created:** [November 6, 2018, 10:36am UTC](https://community.sonatype.com/t/uploading-artifacts-using-shell-commands/772 "2018-11-06T10:36:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![janithh92](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@janithh92](https://community.sonatype.com/u/janithh92)\
**Post date:** [November 6, 2018, 10:36am UTC](https://community.sonatype.com/t/uploading-artifacts-using-shell-commands/772/1 "2018-11-06T10:36:55Z")

</div>

How can I upload artifacts to nexus using linux command line? I am working on node.js, npm project? dist folder have been created using npm install and npm run build commands. But now I don’t know how to upload artifacts? Can someone explain this to me because I am new to these things.

I used this command,

curl --upload-file dist.tgz -v -u admin:zone@123 [http://192.168.94.136:8081/repository/frontend\_snap/hosted/zissa/dist.tgz](http://192.168.94.136:8081/repository/frontend_snap/hosted/zissa/dist.tgz)

But I am getting error.

- About to connect() to 192.168.94.136 port 8081 (#0)
- Trying 192.168.94.136…
- Connected to 192.168.94.136 (192.168.94.136) port 8081 (#0)
- Server auth using Basic with user ‘admin’

> PUT /repository/frontend\_snap/hosted/zissa/dist.tgz HTTP/1.1  
> Authorization: Basic YWRtaW46em9uZUAxMjM=  
> User-Agent: curl/7.29.0  
> Host: 192.168.94.136:8081  
> Accept: _/_  
> Content-Length: 13786906  
> Expect: 100-continue

\< HTTP/1.1 400 Bad Request  
\< Date: Wed, 31 Oct 2018 13:31:10 GMT  
\< Server: Nexus/3.14.0-04 (OSS)  
\< X-Content-Type-Options: nosniff  
\< Content-Security-Policy: sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation  
\< Connection: close

I have created npm(hosted) repository called frontend\_snap

---

<div class="post-metadata">

**Author:** ![nickcook](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/nickcook/32/399_2.png) [@nickcook](https://community.sonatype.com/u/nickcook)\
**Post date:** [November 6, 2018, 11:42am UTC](https://community.sonatype.com/t/uploading-artifacts-using-shell-commands/772/2 "2018-11-06T11:42:16Z")

</div>

We have some documentation around publishing npm packages to hosted repos that might be helpful, check it out here:

[https://help.sonatype.com/repomanager3/node-packaged-modules-and-npm-registries#NodePackagedModulesandnpmRegistries-PublishingnpmPackages](https://help.sonatype.com/repomanager3/node-packaged-modules-and-npm-registries#NodePackagedModulesandnpmRegistries-PublishingnpmPackages)

---

<div class="post-metadata">

**Author:** ![janithh92](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@janithh92](https://community.sonatype.com/u/janithh92)\
**Post date:** [November 7, 2018, 5:14am UTC](https://community.sonatype.com/t/uploading-artifacts-using-shell-commands/772/3 "2018-11-07T05:14:17Z")

</div>

But I want to upload dist.tgz without using npm publish command. Can’t we use mvn deploy plugin?

---

<div class="post-metadata">

**Author:** ![rseddon](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rseddon/32/341_2.png) [@rseddon](https://community.sonatype.com/u/rseddon)\
**Post date:** [November 7, 2018, 1:25pm UTC](https://community.sonatype.com/t/uploading-artifacts-using-shell-commands/772/4 "2018-11-07T13:25:46Z")

</div>

You can also use the REST API: [https://help.sonatype.com/display/NXRM3/Components+API#ComponentsAPI-NPM](https://help.sonatype.com/display/NXRM3/Components+API#ComponentsAPI-NPM)

---

<div class="post-metadata">

**Author:** ![mworthington](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/mworthington/32/64_2.png) [@mworthington](https://community.sonatype.com/u/mworthington)\
**Post date:** [November 7, 2018, 1:40pm UTC](https://community.sonatype.com/t/uploading-artifacts-using-shell-commands/772/5 "2018-11-07T13:40:03Z")

</div>

@janithh92 given that you are just getting started with this, I would strongly encourage you to take a second look at _npm publish_ and how to set up _.npmrc_. Your project and repository are all npm, so why not use the built in npm tooling to package and distribute your application?

While it may be possible to upload and download from a repository in a variety of different ways, creating custom processes that are outside of the native tooling is, in my opinion, one of those “code smells” that will lead to confusion and bugs down the road and should be avoided.
