9

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?

6

It appears that

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

fixes the problem.

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

3
  • 1
    How did you find this out?
    – mtd
    Feb 16 at 17:53
  • 1
    @mtd: emacs-devel mailing list
    – sds
    Feb 16 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 at 22:07
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 '18 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 '18 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 '18 at 0:02
  • I run emacs under cygwin and cygwin has gnutls - is that not enough?
    – Adam
    Jan 9 '18 at 13:50
  • Not sure, I don't have access to a Windows box to test it.
    – colelemonz
    Jan 9 '18 at 19:41

Your Answer

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

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