简体   繁体   中英

Why can't I install packages in Emacs with package-install

Emacs version: 26.3, OS: Ubuntu 19.10

I have the following in init.el:

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

If I open Emacs and do: Mx packages-refresh-contents it shows connecting host: melpa... and package refresh done in 1-2 secs. If I proceed with: Mx package-install <RET> <package> , I always get: no match , but if I go to: Mx package-list-packages I can see the package and can install it via menu and it installs fine.

What am I missing?

This is my setup for package:

(setq package-enable-at-startup nil)
(let ((default-directory "~/.emacs.d/elpa"))
     (normal-top-level-add-subdirs-to-load-path))
     (setq package-check-signature nil)
     (setq use-package-verbose nil)
     (setq package-enable-at-startup t)
     (setq package-archives '(("melpa" . "https://melpa.org/packages/")
                              ("marmalade" . "https://marmalade-repo.org/packages/")
                              ("org" . "https://orgmode.org/elpa/")
                              ("gnu" . "https://elpa.gnu.org/packages/")
                              ("elpy" . "https://jorgenschaefer.github.io/packages/")))
 (package-initialize t)

I overwrite my package-archives variable (not sure what's in yours). I am setting a directory and some other stuff. Have you checked the output of your 'Messages' buffer?

I had this issue when I had too many configurations going. I created my .emacs.d/ folder, but emacs had already created a .emacs file for itself in the home directory, and it was using that instead of the place where I had Melpa configured.

rm ~/.emacs fixed it for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM