Reputation: 1035
I successfully published a package in a private GitLab repository of my organisation. In my global and local .npmrc configuration file I have the following:
# Set URL for your scoped packages.
@<main-package-name>:registry=https://gitlab.<my-organisation-domain>/api/v4/packages/npm/
'//gitlab.<my-organisation-domain>/api/v4/packages/npm/:_authToken'="<my-token>"
'//gitlab.<my-organisation-domain>/api/v4/projects/<my-project-id>/packages/npm/:_authToken'="<my-token>"
In the package.json file I have the following properties:
"publishConfig": {
"@<main-package-name>:registry": "https://gitlab.<my-organisation-domain>/api/v4/projects/<my-package-id>/packages/npm/"
},
"name": "@<main-package-name>/<library-name>",
...
On the GitLab Package and Registry project's page, it says the following:
Installation
npm i @<main-package-name>/<library-name>
Registry setup
echo @<main-package-name>:registry=https://gitlab.<my-organisation-domain>/api/v4/packages/npm/ >> .npmrc
I added "@<main-package-name>/<library-name>": "~0.0.11"
to the project's package.json, but when I try and run npm install I get:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@<main-package-name>/<library-name> - Not found
npm ERR! 404
npm ERR! 404 '@<main-package-name>/<library-name>@~0.0.11' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /path/to/log
It seems it's trying to fetch the package from npmjs instead of the specified GitLab registry. Can anyone help?
Upvotes: 1
Views: 1442
Reputation: 31
Maybe is a problem of encoded url, check if you not have %2f in the url which not found between your scope and package name
For me it was a problem of my virtual host configuration of gitlab
I have add the following lines and that fix my problem:
AllowEncodedSlashes NoDecode
AllowEncodedSlashes On
Upvotes: 0
Reputation: 1035
Removing the local .npmrc in the project where I was requesting the package and keeping just the global one in my home solved the issue, for some very weird reason.
Upvotes: 0