Unable to verify leaf signature

I'm unable to update Node-Red or install/update modules.
Running npm install -g --unsafe-perm node-red results in this error log.

Summary

0 verbose cli [
0 verbose cli 'C:\Program Files\nodejs\node.exe',
0 verbose cli 'C:\Users\mediapc\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
0 verbose cli 'install',
0 verbose cli '-g',
0 verbose cli '--unsafe-perm',
0 verbose cli 'node-red'
0 verbose cli ]
1 info using npm@8.3.0
2 info using node@v18.19.0
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Users\mediapc\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 7ms
6 timing config:load:builtin Completed in 8ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:C:\Users\mediapc.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\mediapc\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:validate Completed in 0ms
15 timing config:load:credentials Completed in 1ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 16ms
18 timing npm:load:configload Completed in 16ms
19 timing npm:load:setTitle Completed in 0ms
20 timing config:load:flatten Completed in 3ms
21 timing npm:load:display Completed in 5ms
22 verbose logfile C:\Users\mediapc\AppData\Local\npm-cache_logs\2024-04-19T02_49_25_852Z-debug-0.log
23 timing npm:load:logFile Completed in 6ms
24 timing npm:load:timers Completed in 0ms
25 timing npm:load:configScope Completed in 0ms
26 timing npm:load Completed in 29ms
27 timing arborist:ctor Completed in 1ms
28 silly logfile start cleaning logs, removing 1 files
29 timing idealTree:init Completed in 6ms
30 timing idealTree:userRequests Completed in 2ms
31 silly idealTree buildDeps
32 silly fetch manifest node-red@*
33 silly placeDep ROOT node-red@ OK for: want: *
34 timing idealTree:#root Completed in 70528ms
35 timing idealTree:node_modules/node-red Completed in 0ms
36 timing idealTree:buildDeps Completed in 70530ms
37 timing idealTree:fixDepFlags Completed in 1ms
38 timing idealTree Completed in 70541ms
39 timing command:install Completed in 70555ms
40 verbose type system
41 verbose stack FetchError: request to https://registry.npmjs.org/node-red failed, reason: unable to verify the first certificate
41 verbose stack at ClientRequest. (C:\Users\mediapc\AppData\Roaming\npm\node_modules\npm\node_modules\minipass-fetch\lib\index.js:110:14)
41 verbose stack at ClientRequest.emit (node:events:517:28)
41 verbose stack at TLSSocket.socketErrorListener (node:_http_client:501:9)
41 verbose stack at TLSSocket.emit (node:events:529:35)
41 verbose stack at emitErrorNT (node:internal/streams/destroy:151:8)
41 verbose stack at emitErrorCloseNT (node:internal/streams/destroy:116:3)
41 verbose stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
42 verbose cwd C:\Windows\System32
43 verbose Windows_NT 10.0.19045
44 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\mediapc\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "--unsafe-perm" "node-red"
45 verbose node v18.19.0
46 verbose npm v8.3.0
47 error code UNABLE_TO_VERIFY_LEAF_SIGNATURE
48 error errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
49 error request to https://registry.npmjs.org/node-red failed, reason: unable to verify the first certificate
50 verbose exit 1
51 timing npm Completed in 71000ms
52 verbose unfinished npm timer reify 1713494966284
53 verbose unfinished npm timer reify:loadTrees 1713494966295
54 verbose code 1
55 error A complete log of this run can be found in:
55 error C:\Users\mediapc\AppData\Local\npm-cache_logs\2024-04-19T02_49_25_852Z-debug-0.log

how did you install node/npm ?

What version of Windows are you running. Are you behind on patches/updates? I'm on 10.0.22631 (W11 23H2)

Windows 10 22H2
19045.4291

Installed npm with msi installer from Node.js — Download Node.js®.
Installed node-red with npm install -g --unsafe-perm node-red

This install has been running for a couple years at this point without issue.

Are you begin a proxy or VPN or some other network thing?

This can also sometimes be the result of a MITM hack.

Failing that, your system has an issue with certs.

I think the issue was being caused by Eset antivirus https scanning. I removed eset and the problem went away. Re-installed eset and the problem did not return. Anyhow everything appears to be working again.

Thanks