UNABLE_TO_VERIFY_LEAF_SIGNATURE after `apt install npm`

I'm actually attempting to install gTile, which requires Bazelisk.

On a relatively clean system:

$ sudo apt install npm
# takes almost 5 minutes, then:
$ npm install -g @bazel/bazelisk
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to failed, reason: unable to verify the first certificate
npm ERR! A complete log of this run can be found in:
npm ERR! /home/celiyah/.npm/_logs/2021-05-17T16_21_40_542Z-debug.log

Based on this SO answer I also tried:

$ npm install ssl-root-cas
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to failed, reason: unable to verify the first certificate
npm ERR! A complete log of this run can be found in:
npm ERR! /home/celiyah/.npm/_logs/2021-05-17T16_23_34_826Z-debug.log

It would appear the npm install on Ubuntu is broken?

$ npm --version
6.14.8

Has anyone run into this error, and how does one fix it (without disabling security)?

On that note please don't mention turning SSL off. This is a secure machine and I'd like to keep it that way. :-)

1 Answer

The error disappears after reboot; after you sudo apt install npm, reboot the computer.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like