Open jswanso opened 1 year ago
Hi @jswanso Thanks for using this package and for filling this issue.
The idea behind use a local registry is that you don't have to interact with an external service in order to use this package (it is useful if you do a workshop and don't have access to internet).
When the project started they created a script to emulate npm registry and as you mention around mid 2020 we changed it to use verdaccio.
Until I understand you, you are having same problem as #150, right? If you have a trace or some useful information about the error please add it in the same issue to get all centralized in the same place. I'll try to find some time this week to debug the error.
In the meantime I will suggest you to skip the "Login" challenge and try other ones.
. I also saw this was upgraded to use verdaccio https://github.com/workshopper/how-to-npm/pull/143 for the local registry back in May/Jun 2020, and I have to imagine that is a very old version which might be why it doesn't run with my npm 9.5.1.
Hi folks, I'd love to help upgrading verdaccio and ensure works fine in all npm versions. Btw, after npm@9.5.0 has introduced a fallback login which should works fine by default.
Anyhow, :) I have no enough rights to give some love to this repo but if I'd get some, I'll be happy yo review PRs.
I am working on reproducing the issue with detailed logs. Right now I am getting ECONNREFUSED, but guessing that is because my registry isn't starting up for some reason. I have reset the registry a couple times trying to troubleshoot the issue so maybe I locked a port or something. I am hoping a reboot will fix my issue.
I'll keep you posted.
BTW: I pulled down the latest verdaccio and was able to add a user to it locally without any problems.
Thanks @ccarruitero and @juanpicado for responding and willing to take a look at this!
I was really pleased when working through the exercise to learn you used a local registry to create a sandbox for running these labs. I don't have an npmjs.com account and didn't want to create one just to use this lab.
Here is a detailed rundown of my setup.
For full disclosure I installed this npm package locally instead of globally and then use npx
to run the commands. I've never had an issue with this in other projects and I assume this isn't the issue.
After installing the "how-to-npm" package, I ran into multiple issues, but have been able to work through most of them so far by installing missing/outdated packages. Here is what my package.json file looks like for the missing dependencies.
``` { "dependencies": { "concat-stream": "^2.0.0", "how-to-npm": "^2.5.1", "which": "^3.0.1", "workshopper-adventure": "^7.0.0" } } ```
Step 2 "02 login" is where I have the issue. I've created a sub directory called "workdir" that is my working directory for running the "02 Login" commands. After running npm init -y
in the "workdir" folder it has two files.
- .npmrc - package.json
```
registry = http://localhost:15443/
userconfig = C:\Users\
``` { "name": "workdir", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC" } ```
I ran both npm adduser
and npm adduser --auth-type=legacy
which both failed with the error "No credentials to set." Here is the detailed log message from the second command, but really the error message is the same from either command.
```
0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using npm@9.5.1
2 info using node@v18.16.0
3 timing npm:load:whichnode Completed in 2ms
4 timing config:load:defaults Completed in 3ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:c:\gittrain\nodeschool-npm2\workdir\.npmrc Completed in 1ms
10 timing config:load:project Completed in 6ms
11 timing config:load:file:C:\Users\
As seen in the detailed log it is failing on the HTTP put to local host with "No credentials to set". In a separate test I pulled down the "verdaccio" package to run locally just to see if my npm adduser
command would get a similar issue, but it worked just fine. Of course, I was running the latest version verdaccio.
Other contextual detail.
``` { workdir: '1.0.0', npm: '9.5.1', node: '18.16.0', acorn: '8.8.2', ada: '1.0.4', ares: '1.19.0', brotli: '1.0.9', cldr: '42.0', icu: '72.1', llhttp: '6.0.10', modules: '108', napi: '8', nghttp2: '1.52.0', nghttp3: '0.7.0', ngtcp2: '0.8.1', openssl: '3.0.8+quic', simdutf: '3.2.2', tz: '2022g', undici: '5.21.0', unicode: '15.0', uv: '1.44.2', uvwasi: '0.0.15', v8: '10.2.154.26-node.26', zlib: '1.2.13' } ```
- OS Name: Microsoft Windows 10 Pro - OS Version: 10.0.19042 N/A Build 19042 - OS Manufacturer: Microsoft Corporation
I've done a little more debugging locally on the code to see if I could spot the issue, but I think I am missing some context on the setup of these workshops. I didn't find any additional architecture and getting started documentation in this repository to go further into debugging.
Any help is appreciated. If you have any additional resources you could point me at to help fill in the gaps that would also be great.
Hello @juanpicado and @ccarruitero
I traced through the npm CLI code to see why I get a "No credentials to set" error. Here are my findings.
The locally hosted Verdaccio registry used in the latest how-to-npm package doesn't return a token when npm adduser command is called and subsequently errors out. I am use npm version 9.5.1.
The CLI npm adduser command calls setCredentialsByURI method passing in new credentials (newCreds). All the parameters passed into the setCredentialsByURI method are undefined other than the URI parameter which, as expected, points to the localhost (i.e., http://localhost:15443/). The setCredentialsByURI method is what throws the No credentials to set error that is reported in my prior log.
Walking backwards in the code I see that the auth.adduser method returns the newCreds variable which consists of { token: undefined }
.
Stepping into the auth.js adduser method I see the profile.adduserCouch method called with the command line username, email, and password that I supplied in the CLI when prompted.
The adduserCouch method looks like it does a HTTP PUT to the local registry which based on the logs is successful with a HTTP Status Code of 201. The returned results res consists of { ok: 'created', username: 'justin' }
, but it doesn't have a token returned. Subsequently the auth.js adduser method returns the undefined token to the calling adduser method.
Assuming that the npm CLI code is correct, the issue seems to be with the locally hosted repository not returning a token. I don't know what the expectations are of this registry, and I hope someone can provide the answer.
For comparison, when I run the latest verdaccio locally my npm adduser works fine and I see the returned payload has a provided token.
Verdaccio returned payload example: { ok: "user 'user1' created", token: 'VkPPcaSLZxmz+bMm822Qyw==', username: 'user1' }
I know @ccarruitero you suggested that I skip # 02, but I fear that doing so is only going to get me so far before I run into this registry issue again. I am hoping the detailed write above will help you in triaging this issue. I am not sure there is much more I can do to help on this without having more background on the design of this workshop.
Further guidance is appreciated.
Hi @jswanso did you ever get anywhere with this? I'm having the same issue over a year later.
Hello @juanpicado and @ccarruitero
I traced through the npm CLI code to see why I get a "No credentials to set" error. Here are my findings.
Summary
The locally hosted Verdaccio registry used in the latest how-to-npm package doesn't return a token when npm adduser command is called and subsequently errors out. I am use npm version 9.5.1.
Details
The CLI npm adduser command calls setCredentialsByURI method passing in new credentials (newCreds). All the parameters passed into the setCredentialsByURI method are undefined other than the URI parameter which, as expected, points to the localhost (i.e., http://localhost:15443/). The setCredentialsByURI method is what throws the No credentials to set error that is reported in my prior log.
Walking backwards in the code I see that the auth.adduser method returns the newCreds variable which consists of
{ token: undefined }
.Stepping into the auth.js adduser method I see the profile.adduserCouch method called with the command line username, email, and password that I supplied in the CLI when prompted.
The adduserCouch method looks like it does a HTTP PUT to the local registry which based on the logs is successful with a HTTP Status Code of 201. The returned results res consists of
{ ok: 'created', username: 'justin' }
, but it doesn't have a token returned. Subsequently the auth.js adduser method returns the undefined token to the calling adduser method.Assuming that the npm CLI code is correct, the issue seems to be with the locally hosted repository not returning a token. I don't know what the expectations are of this registry, and I hope someone can provide the answer.
For comparison, when I run the latest verdaccio locally my npm adduser works fine and I see the returned payload has a provided token.
Verdaccio returned payload example:
{ ok: "user 'user1' created", token: 'VkPPcaSLZxmz+bMm822Qyw==', username: 'user1' }
Follow-up
I know @ccarruitero you suggested that I skip # 02, but I fear that doing so is only going to get me so far before I run into this registry issue again. I am hoping the detailed write above will help you in triaging this issue. I am not sure there is much more I can do to help on this without having more background on the design of this workshop.
Further guidance is appreciated.
Hello @juanpicado, @watilde, @EmmaRamirez, @ccarruitero, et al.
Is this repository still being maintained in 2023? There is nothing on the ReadMe that says it's deprecated. Also, it is still referenced on nodeschool, but the last checkin was August 20, 2020. If the project is not being maintained it would be helpful to have that noted in the ReadMe. I don't want to invest more time into trying to run this if there are no maintainers.
I can submit an official issue if this is still being maintained, but didn't want to go through all that effort if it is not maintained.
Any suggestions on future intent of this project or needs would be helpful for me to know if I should invest any more time in getting this running. If it was a good training I was hoping to add it to my team's official list of training.
Short summary of my issue is that the local registry doesn't allow me to add a user on a windows machine running npm 9.5.1. Possibly because it can't bootstap a root user. I saw an open issue #150 that seemed related, but I have tried the recommendation without any luck. I also saw this was upgraded to use verdaccio #143 for the local registry back in May/Jun 2020, and I have to imagine that is a very old version which might be why it doesn't run with my npm 9.5.1. I couldn't find any docs/readmes in this repository that readily defined the design and intent of the locally registry setup which makes it difficult to triage this issue on my own without wading through all the code and build process of this package.
Any guidance or referenced material is appreciated.
Thanks!