Hello, fellow forum members!
Straight to the point…
I created a test repo to try publishing private NPM packages. I wanted to try it with Lerna first, that’s why the project name is ‘lerna-experiment’, but I am not able to get even a basic npm publish to work.
The repo setup is the most basic setup you can have. The entire repo consists of index.js, package.json, and .npmrc.
Contents of index.js:
module.exports = "test"
Contents of package.json:
{
"name": "@lerna-experiment/test",
"version": "1.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/<my_username>/lerna-experiment.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://gitlab.com/<my_username>/lerna-experiment/issues"
},
"homepage": "https://gitlab.com/<my_username>/lerna-experiment#readme",
"publishConfig": {
"@lerna-experiment:registry": "https://gitlab.com/api/v4/projects/<project_id>/packages/npm/"
}
}
Contents .npmrc:
@lerna-experiment:registry=https://gitlab.com/api/v4/packages/npm/
//gitlab.com/api/v4/packages/npm/:_authToken=<my_auth_token>
//gitlab.com/api/v4/projects/<project_id>/packages/npm/:_authToken=<my_auth_token>
And this is what happens when I try npm publish…
npm ERR! code E400
npm ERR! 400 Bad Request - PUT https://gitlab.com/api/v4/projects/<project_id>/packages/npm/@lerna-experiment%2ftest
I tried manually setting the registry URL with npm set
but it had no effect. The project is not a part of any group.
What could I be doing wrong?
Thank you in advance for your answers.