Hey there,
While working on a demo I noticed that all my lines had a 2px stroke even when I specify the stroke weight to 1.
See the following image where:

You can also test on this url: https://codepen.io/Mamboleoo/pen/PoqYzJj
I checked on multiple browsers and the result seems to be the same. The second line is always thicker than the rectangle, but a bit less opaque than the third line.
Thanks for having a look
I cannot replicate this on macOS (Firefox, Chrome, Safari) and iPhone SE (Safari and Firefox). It sounds like a subpixel drawing issue, can you try drawing the second line at a different location to see if it still exhibit that behaviour?
I cannot try on MacOs right now but here is a screenshot on my iPhone when zooming.

Both blue lines have the same setting with one difference, the y coordinates are [250,250] for the top blue line and [210.5,210.5] for the bottom one.
On my windows laptop the bottom blue line is also displayed well (1px thick).
I seems to be a subpixel issue but I wonder why moving the line by half a pixel makes it sharper?
Judging by the results of the bluelines I would say it looks more and more like subpixel rendering limitation. This is something native to the HTML Canvas API (and a lot of other drawing programs).
The reason why drawing at half a pixel makes the line sharper is rather subtle. You can find an explanation of it here about 1/4 ways down in a "Ask Professor Markup" section.
That's exactly it. I just checked with vanilla Canvas API and I'm having the same result (top being round number and below '0.5' coordinates).

Thanks for your answers 馃檹
When w and h are even numbers the line is 2 px thick , if the height and witdh are odd then the line will be one pixel.
0,0 doesn't start from the pixel , but between the pixels.

consider the numbers as a row of pixels.