-
I've got a mono-repo setup with To build the docker images for servers in the project, I'm using verdaccio as a GitLab service. In the build phase, I want to publish packages and when running the server I'm planing to install them from the verdaccio registry. With GitLab CI services we can not pass config files to the service. (APMK) Currently the error I'm having is, error with auth, since I'm trying to publish a scoped package. Step 14/24 : RUN lerna publish from-package --yes --no-git-reset
---> Running in 9c2db92f90f0
info cli using local version of lerna
lerna notice cli v4.0.0
lerna notice FYI Unable to verify working tree, proceed at your own risk
lerna WARN Unable to determine published version, assuming "@scope/package-1" unpublished.
lerna WARN Unable to determine published version, assuming "@scope/package-2" unpublished.
Found 2 packages to publish:
- @scope/package-1 => 1.0.0
- @scope/package-2 => 1.0.0
lerna info auto-confirmed
lerna info publish Publishing packages to npm...
lerna notice Skipping all user and access validation due to third-party registry
lerna notice Make sure you're authenticated properly ¯\_(ツ)_/¯
lerna notice FYI Unable to set temporary gitHead property, it will be missing from registry metadata
lerna info lifecycle root@undefined~prepare: root@undefined
lerna WARN lifecycle root@undefined~prepare: cannot run in wd root@undefined husky install (wd=/home/app)
lerna http fetch PUT 401 http://verdaccio:4873/@scope%2fpackage-1 26ms
lerna ERR! E401 authorization required to publish package @scope/package-1
The command '/bin/sh -c lerna publish from-package --yes --no-git-reset' returned a non-zero code: 1
In the CI environment I can not run Some like RUN npm adduser <<! \
auser \
'1234' \
[email protected] \
! Can I create a user inside a Dockerfile or can I bypass auth for scoped packages? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 12 replies
-
Could you create a docker image based on Verdaccio and provide a
I haven't tried but worth the give it a chance. |
Beta Was this translation helpful? Give feedback.
-
At work we use npm-cli-login to authenticate against nexus, verdaccio and others. Maybe this is helpful for you. |
Beta Was this translation helpful? Give feedback.
-
@juanpicado I have tried RUN curl -XPUT -H "Content-type: application/json" -d '{ "name": "test", "1234": "1234" }' 'http://verdaccio:4873/-/user/scope:test' It gives ---> Running in 5a27265a1f1c
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 198 100 162 100 36 2276 505 --:--:-- --:--:-- --:--:-- 2281
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot PUT /-/user/scope:test</pre>
</body>
</html> |
Beta Was this translation helpful? Give feedback.
-
After giving some digging to @DanielRuf idea I did following setup RUN npx npm-cli-adduser --registry http://verdaccio:4873 --username test --password 1234 --email [email protected] --scope @scope It gets npx: installed 2 in 1.687s
Username: test
Password:
Email: (this IS public) [email protected]
Logged in as test to scope @scope on http://verdaccio:4873/. But when publishing I'm getting RUN npm whoami && lerna publish from-package --yes --no-git-reset
---> Running in 983928ac215a
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
npm ERR! need auth You need to authorize this machine using `npm adduser`
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-08-20T04_59_16_542Z-debug.log
The command '/bin/sh -c npm whoami && lerna publish from-package --yes --no-git-reset' returned a non-zero code: 1 |
Beta Was this translation helpful? Give feedback.
At work we use npm-cli-login to authenticate against nexus, verdaccio and others. Maybe this is helpful for you.
https://www.npmjs.com/package/npm-cli-login