1

I have this in my init.el file

(when (not (package-installed-p 'geiser))
  (package-install 'geiser))

But when I start emacs, I get the error

Warning (initialization): An error occurred while loading '/home/ykp/.emacs.d/init.el':

error: Package 'geiser-' is unavailable.

How do I fix this? I just want to avoid manually installing my package and do it through my initialization script.

2
  • The error message refers to package geiser-, with a hyphen, not to package geiser. Does your code perhaps use geiser- where it should use geiser?
    – Drew
    Aug 12, 2021 at 17:52
  • nope -- not using geiser anywhere.
    – Kashif
    Aug 12, 2021 at 19:21

1 Answer 1

2

You have to use package-refresh-contents before trying to install a package. From C-h f package-refresh-contents:

Download descriptions of all configured ELPA packages. For each archive configured in the variable `package-archives', inform Emacs about the latest versions of all packages it offers, and make them available for download.

So you could try something like this somewhere near the beginning of your init.el, at least before you try to install the packages you want:

(require 'package)
(package-refresh-contents)
1
  • you might also want to look at use-package and the :ensure t option in particular
    – zzkt
    Aug 13, 2021 at 9:08

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.