# Npm package under organization (solved)

**URL:** <https://forum.gitea.com/t/npm-package-under-organization-solved/6414>\
**Category:** Gitea Usages\
**Created:** [December 15, 2022, 9:28pm UTC](https://forum.gitea.com/t/npm-package-under-organization-solved/6414 "2022-12-15T21:28:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![darren-martz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/darren-martz/32/3300_2.png) [@darren-martz](https://forum.gitea.com/u/darren-martz)\
**Post date:** [December 15, 2022, 9:28pm UTC](https://forum.gitea.com/t/npm-package-under-organization-solved/6414/1 "2022-12-15T21:28:59Z")

</div>

I am attempting to publish an npm package into a private organization, but am struggling.

Following the gitea instructions I now have a revised .npmrc file using the “npm config set” calls suggested.

One confusing part is the {token} mentioned in the docs. Where does that come from? My assumption was the application token that we can generate, which is what I used.

Another assumption from the docs was that the {owner} can be replaced by the organization code.

The result experienced is always the same

```auto
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://mygitdomain.tld/api/packages/myorg/npm/
npm ERR! need auth You need to authorize this machine using `npm adduser`

```

What am I missing or misunderstanding here?

---

<div class="post-metadata">

**Author:** ![darren-martz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/darren-martz/32/3300_2.png) [@darren-martz](https://forum.gitea.com/u/darren-martz)\
**Post date:** [December 15, 2022, 10:23pm UTC](https://forum.gitea.com/t/npm-package-under-organization-solved/6414/2 "2022-12-15T22:23:39Z")

</div>

Of course I figured it out right after posting the question. However, the answer may be good to update the documentation.

It was in the .npmrc file

```auto
registry=https://mygitdomain.tld/api/packages/myorg/npm/
//mygitdomain.tld/api/packages/myorg/npm/:_authToken={application_token}
//mygitdomain.tld/api/packages/npm/:_authToken={application_token}

```

The trick was a second auth line without the username/organization in the path.

---

<div class="post-metadata">

**Author:** ![moray](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/moray/32/4260_2.png) [@moray](https://forum.gitea.com/u/moray)\
**Post date:** [December 12, 2023, 10:50pm UTC](https://forum.gitea.com/t/npm-package-under-organization-solved/6414/4 "2023-12-12T22:50:58Z")

</div>

I have been having this issue but I can’t get it to work with my gitea installation (docker, version 1.21.1)

I create a token with my user (permissions to the packages endpoint) but npm does not authenticate. Am I missing something?

```auto
registry=https://gitea.mydomain.com/api/packages/myuser/npm
//gitea.mydomain.com/api/packages/myuser/npm/:_authToken=xxxxx96a2f833805fddff79735905fdec99xxxxx
//gitea.mydomain.com/api/packages/npm/:_authToken=xxxxx96a2f833805fddff79735905fdec99xxxxx

```

```auto
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://gitea.mydomain.com/api/packages/myuser/npm
npm ERR! need auth You need to authorize this machine using `npm adduser`

```

---

<div class="post-metadata">

**Author:** ![lunny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/lunny/32/4701_2.png) [@lunny](https://forum.gitea.com/u/lunny)\
**Post date:** [December 20, 2023, 4:29am UTC](https://forum.gitea.com/t/npm-package-under-organization-solved/6414/5 "2023-12-20T04:29:33Z")

</div>

How about use the command? ref [npm Package Registry | Gitea Documentation](https://docs.gitea.com/usage/packages/npm#configuring-the-package-registry)

---

<div class="post-metadata">

**Author:** ![jhr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/jhr/32/4287_2.png) [@jhr](https://forum.gitea.com/u/jhr)\
**Post date:** [December 20, 2023, 10:02am UTC](https://forum.gitea.com/t/npm-package-under-organization-solved/6414/6 "2023-12-20T10:02:13Z")

</div>

I have the same problem that i cannot push packages to the npm repo. But it says that the permission to upload package is not permitted.  
I got http 403:  
(anonymized)

```auto
npm notice Publishing to https://git.gitea.com/api/packages/username/npm/ with tag latest and default access
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://git.gitea.com/api/packages/username/npm/packagename - no permission to upload this package
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.

```

Can anybody help? I added repos and tokens as described inside the documentation. Also with allowing anything for the token will not work.

---

<div class="post-metadata">

**Author:** ![apreiml](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/apreiml/32/4488_2.png) [@apreiml](https://forum.gitea.com/u/apreiml)\
**Post date:** [March 11, 2024, 2:28pm UTC](https://forum.gitea.com/t/npm-package-under-organization-solved/6414/7 "2024-03-11T14:28:18Z")

</div>

Make sure that your token has write permissions to `package`.
