Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm install results in error UNABLE_TO_GET_ISSUER_CERT_LOCALLY #7326

Closed
2 tasks done
willfaught opened this issue Apr 1, 2024 · 6 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x

Comments

@willfaught
Copy link

willfaught commented Apr 1, 2024

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npm install fails:

❯ npm install
(⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠧ idealTree:paige: sill idealTree buildDeps
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/katex failed, reason: unable to get local issuer certificate

npm ERR! A complete log of this run can be found in: /Users/will/.npm/_logs/2024-04-01T03_15_18_212Z-debug-0.log

I'm not behind a corporate firewall. I don't use a VPN. I haven't added to, removed from, or modified the default system certs. I'm not willing to permanently change the default settings to not require cert verification. NPM worked fine on my old Mac before I migrated to this Mac.

Expected Behavior

npm install succeeds.

Steps To Reproduce

With package.json:

{
  "dependencies": {
    "bootstrap": "^5.3.2",
    "bootstrap-icons": "^1.11.0",
    "katex": "^0.16.10"
  }
}

npm install output for about 60 seconds:

$ npm install
(⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠧ idealTree:paige: sill idealTree buildDeps

then:

$ npm install
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/katex failed, reason: unable to get local issuer certificate

npm ERR! A complete log of this run can be found in: /Users/will/.npm/_logs/2024-04-01T03_15_18_212Z-debug-0.log

Content of /Users/will/.npm/_logs/2024-04-01T03_15_18_212Z-debug-0.log:

0 verbose cli /opt/homebrew/Cellar/node/21.7.1/bin/node /opt/homebrew/bin/npm
1 info using npm@10.5.0
2 info using node@v21.7.1
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 0ms
5 timing config:load:file:/opt/homebrew/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 0ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/Users/will/Developer/paige/paige/.npmrc Completed in 0ms
10 timing config:load:project Completed in 0ms
11 timing config:load:file:/Users/will/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/opt/homebrew/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 3ms
17 timing npm:load:configload Completed in 3ms
18 timing config:load:flatten Completed in 1ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm install
22 verbose argv "install"
23 timing npm:load:setTitle Completed in 2ms
24 timing npm:load:display Completed in 0ms
25 verbose logfile logs-max:10 dir:/Users/will/.npm/_logs/2024-04-01T03_15_18_212Z-
26 verbose logfile /Users/will/.npm/_logs/2024-04-01T03_15_18_212Z-debug-0.log
27 timing npm:load:logFile Completed in 3ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 14ms
31 timing arborist:ctor Completed in 1ms
32 silly logfile start cleaning logs, removing 1 files
33 silly logfile done cleaning log files
34 timing idealTree:init Completed in 6ms
35 timing idealTree:userRequests Completed in 0ms
36 silly idealTree buildDeps
37 silly fetch manifest katex@^0.16.10
38 timing arborist:ctor Completed in 0ms
39 silly placeDep ROOT katex@ REPLACE for:  want: ^0.16.10
40 timing idealTree:#root Completed in 70296ms
41 timing idealTree:node_modules/katex Completed in 0ms
42 timing idealTree:buildDeps Completed in 70297ms
43 timing idealTree:fixDepFlags Completed in 0ms
44 timing idealTree Completed in 70304ms
45 timing command:install Completed in 70308ms
46 verbose type system
47 verbose stack FetchError: request to https://registry.npmjs.org/katex failed, reason: unable to get local issuer certificate
47 verbose stack     at ClientRequest.<anonymous> (/opt/homebrew/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
47 verbose stack     at ClientRequest.emit (node:events:519:28)
47 verbose stack     at _destroy (node:_http_client:880:13)
47 verbose stack     at onSocketNT (node:_http_client:900:5)
47 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
48 verbose cwd /Users/will/Developer/paige/paige
49 verbose Darwin 23.3.0
50 verbose node v21.7.1
51 verbose npm  v10.5.0
52 error code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
53 error errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
54 error request to https://registry.npmjs.org/katex failed, reason: unable to get local issuer certificate
55 verbose exit 1
56 timing npm Completed in 70369ms
57 verbose unfinished npm timer reify 1711941318270
58 verbose unfinished npm timer reify:loadTrees 1711941318272
59 verbose code 1
60 error A complete log of this run can be found in: /Users/will/.npm/_logs/2024-04-01T03_15_18_212Z-debug-0.log

Environment

  • npm: 10.5.0
  • Node.js: v21.7.1
  • OS Name: macOS 14.3.1
  • System Model Name: MacBook Pro
  • npm config:
; "builtin" config from /opt/homebrew/lib/node_modules/npm/npmrc

prefix = "/opt/homebrew" 

; "user" config from /Users/will/.npmrc

registry = "https://registry.npmjs.org/" 

; node bin location = /opt/homebrew/Cellar/node/21.7.1/bin/node
; node version = v21.7.1
; npm local prefix = /Users/will/Developer/paige/paige
; npm version = 10.5.0
; cwd = /Users/will/Developer/paige/paige
; HOME = /Users/will
; Run `npm config ls -l` to show all defaults.
@willfaught willfaught added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Apr 1, 2024
@wraithgar
Copy link
Member

This is usually because of a proxy you are in that is not providing valid ssl certificates. You can disable strict ssl in npm with strict-ssl but it's likely you'll have other problems with any node application trying to make network requests. The best solution is to contact your IT department and ask them how to configure node properly so it recognizes the certificates they're providing.

@willfaught
Copy link
Author

@wraithgar Not in this case:

I'm not behind a corporate firewall. I don't use a VPN.

@wraithgar
Copy link
Member

npm itself does not negotiate ssl certificates. That's a pretty low level task done by node's own http/https modules. All npm can do is tell it to not use strict ssl. Errors w/ node connecting to https is not generally an npm issue.

@willfaught
Copy link
Author

It's not my computer, as far as I know. I used Migration Assistant when switching Macs, so all the files and configuration are the same. Is there a way to debug this that you recommend? I haven't had TLS/SSL connection issues with any other program, including the Homebrew package manager.

@wraithgar
Copy link
Member

I'd start by searching for other folks who had this problem w/ homebrew node. Homebrew/homebrew-core#92271 (comment)

@willfaught
Copy link
Author

Thanks for the link. That looked promising, but I checked, and I don't have openssl@1.1 installed. I just did a brew update, and now it works for some reason. It looks like @1.1 is deprecated, but node depends on @3, so I dunno.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x
Projects
None yet
Development

No branches or pull requests

2 participants