10

I am trying to set up emacs (on cygwin / Win10) to handle JSON.

I started with joshwnj/json-mode and was stoked to discover that emacs will now install its own dependencies from online repos. Fab stuff.

I can run M-x package-install but I notice it logs the message:

Contacting host: elpa.gnu.org:80
Failed to download ‘gnu’ archive.

And when I type in json-mode, emacs says there's no match. Is this a connection problem? Should I see an HTTP error somewhere?

joshwnj/json-mode says I need the MELPA repository set up.

According to this documentation for MELPA I need to identify if I'm using package.el (which looks good) and work out if the given lisp code is in place.

Is there a command I can run in emacs to tell me if this code is in place?

Trying to following on and ignoring that issue, I tried M-x package-list-packages and got the following error:

You can run the command ‘package-list-packages’ with M-x pa-l- RET
Waiting for refresh to finish...
Package refresh done
No packages to upgrade.
error in process sentinel: Error retrieving: http://elpa.gnu.org/packages/archive-contents (error connection-failed "failed with code 10060
" :host "elpa.gnu.org" :service 80)
error in process sentinel: Error retrieving: http://elpa.gnu.org/packages/archive-contents (error connection-failed "failed with code 10060
" :host "elpa.gnu.org" :service 80)

Is the sentinel process critical? Did the package refresh work?

What should I try next?

2 Answers 2

7

It appears that

(custom-set-variables
 '(gnutls-algorithm-priority "normal:-vers-tls1.3"))

fixes the problem.

Cf. https://stackoverflow.com/a/60638601/850781

4
  • 1
    How did you find this out?
    – mtd
    Feb 16, 2021 at 17:53
  • 1
    @mtd: emacs-devel mailing list
    – sds
    Feb 16, 2021 at 17:55
  • 1
    thanks. FWIW, I am still seeing the reported symptom, and your fix addressing it, using emacs 27.1 (` emacs-27.1-2.fc33.x86_64`).
    – mtd
    Feb 16, 2021 at 22:07
  • fwiw it fixed it for me on "GNU Emacs 27.2 (build 1, x86_64-apple-darwin21.1.0, Carbon Version 165 AppKit 2113) of 2021-12-11"
    – algal
    Jan 21, 2022 at 0:32
2

Have you tried to set the package-archives variable in your configuration file?

I have added the following lines to my configuration to get packages from elpa, marmalade, and melpa:

(package-initialize)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
5
  • 1
    Although I haven't checked, I assume I already have those set by default because of the error. If I do M-x package-refresh-contents I get Contacting host: elpa.gnu.org:80 Failed to download ‘gnu’ archive.
    – Adam
    Jan 8, 2018 at 13:05
  • The ELPA repository may be set up by default, but the MELPA (which you said that you needed) and Maramalde repositories won't be set up by default.
    – colelemonz
    Jan 8, 2018 at 23:59
  • 2
    Looking into the issue further, are you by chance behind a firewall? That may be blocking your connection to ELPA. Furthermore, have you installed GnuTLS? If you are on Windows, i refer you to here, and this may also be useful.
    – colelemonz
    Jan 9, 2018 at 0:02
  • I run emacs under cygwin and cygwin has gnutls - is that not enough?
    – Adam
    Jan 9, 2018 at 13:50
  • Not sure, I don't have access to a Windows box to test it.
    – colelemonz
    Jan 9, 2018 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.