1

I am starting to build up a .emacs file to be used as a development environment within Docker containers. I get this error when starting emacs-nox in a Docker container.

Error (use-package): Failed to install magit: Package `magit-' is unavailable
Error (use-package): Cannot load magit

Here is the contents of my .emacs

;; require package
(require 'package)

;; add melpa stable
(add-to-list 'package-archives
         '("melpa-stable" . "https://stable.melpa.org/packages/"))

;; add melpa
(add-to-list 'package-archives
         '("melpa" . "http://melpa.milkbox.net/packages/"))

;; Initialise packages
(package-initialize)

;; get latest package information
(package-refresh-contents)

;; add use package
;; so packages can automatically be installed
;; required for reuse across computer or docker containers
(package-install 'use-package)

;; add magit for git
(use-package magit
  :ensure t
  :pin melpa-stable)
  • Which emacs version are you using? – Kaligule Mar 6 '18 at 7:54
  • M-x version: "GNU Emacs 24.5.1 (x86_64-pc-linux-gnu) of 2017-09-12 on hullmann, modified by Debian" – learningemacs Mar 6 '18 at 14:15
  • 2
    I've run into this issue before. Run M-x package-refresh-contents and try again? – Chakravarthy Raghunandan Mar 6 '18 at 16:28
  • @ChakravarthyRaghunandan that did not work for me. I did M-x package-refresh-contents and then M-x eval-region on (use-package magit :ensure t :pin melpa-stable). I get the same error message. – learningemacs Mar 6 '18 at 17:39
  • Tried install the magit using M-x package-install RET magit ? – Chakravarthy Raghunandan Mar 6 '18 at 18:05
1

Thanks to the help of @ChakravarthyRaghunandan and @Kaligule and rereading the Melpa getting started I have been able to use use-package to install magit in a docker container in emacs-nox. The dockerfile starts with FROM debian:stable.

At https://melpa.org/#/getting-started it says:

There are some problems using the https location with Emacs on Windows. There is currently no know easy fix for this. You can still use MELPA by using the non-SSL location by replacing https with http.

So I tried using http instead of https in the melpa urls.

(add-to-list 'package-archives
         '("melpa-stable" . "http://stable.melpa.org/packages/"))

(add-to-list 'package-archives
         '("melpa" . "http://melpa.org/packages/"))

That got it working.

  • I think an answer that uses https would be a better answer. – learningemacs Mar 7 '18 at 16:27

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.