最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

error: Package ‘use-package-’ is unavailable (emacs 27.1) - Stack Overflow

programmeradmin2浏览0评论

I'm new to Emacs and started configuring it yesterday. And everything was going ok (show number lines, fonts, themes) but when I tried to install packages (MELPA) it keeps showing this.

MY OS: LINUX MINT 21.3

I'm getting this message when I start Emacs after configuring init.el: error: Package ‘use-package-’ is unavailable

EDIT: So I was trying to solve this and I learned that if just do this:

(require 'package)
(add-to-list 'package-archives
         '("melpa" . "/") t)
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

It works! The problem is when I try to install use-package. Then it returns:

Failed to verify signature: bind-key-2.4.1.tar.sig

My config is:

;; Configuração básica do Emacs
(setq inhibit-startup-message t)     ; Desabilita a tela inicial do Emacs

(tool-bar-mode -1)                   ; Oculta a barra de ferramentas
(menu-bar-mode -1)                   ; Oculta a barra de menu
(scroll-bar-mode -1)                 ; Oculta a barra de rolagem
(tooltip-mode -1)                    ; Oculta dicas

(global-display-line-numbers-mode t) ; Exibe numeração de linhas
(column-number-mode t)               ; Exibe coluna atual na modeline

;; Alertas visuais
(setq visible-bell t)

;; Espaçamento das bordas laterais
(set-fringe-mode 10)

;; Outros
(delete-selection-mode t)            ; O texto digitado substitui a seleção

;; Rolagem mais suave
(setq mouse-wheel-scroll-amount '(2 ((shift) . 1)) ; 2 linhas por vez
      mouse-wheel-progressive-speed nil            ; Não acelera a rolagem
      mouse-wheel-follow-mouse 't                  ; Rola a janela sob o mouse
      scroll-step 1)                               ; Rola 1 linha com teclado

;; Quebras de linha
(global-visual-line-mode t)

;; Organizando os backups
(setq backup-directory-alist '(("." . "~/.saves"))) 

;; Definição temporária do tema
(load-theme 'tango-dark t)

;; Fonte padrão
(set-face-attribute 'default nil :font "Monospace" :height 140)

;; Tipo de cursor
(setq-default cursor-type 'box)

;; Função para criar um novo buffer
(defun debmx-new-buffer ()
  "Cria um novo buffer 'sem nome'."
  (interactive)
  (let ((debmx/buf (generate-new-buffer "sem-nome")))
    (switch-to-buffer debmx/buf)
    (funcall initial-major-mode)
    (setq buffer-offer-save t)
    debmx/buf))

;; Modo inicial
(setq initial-major-mode 'prog-mode)
(setq initial-buffer-choice 'debmx-new-buffer)

;; Verifica e inicia o package.el
(require 'package)

;; Definição de repositórios
(setq package-archives '(("melpa" . "/")
                         ("elpa"  . "/")))

;; Inicialização do sistema de pacotes
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

; Instalação do use-package
(unless (package-installed-p 'use-package)
  (package-install 'use-package))
  
(require 'use-package)
(setq use-package-always-ensure t)

;; Instalação do auto-update

(use-package auto-package-update
  :custom
  (auto-package-update-interval 7)
  (auto-package-update-prompt-before-update t)
  (auto-package-update-hide-results t)
  :config
  (auto-package-update-maybe)
  (auto-package-update-at-time "21:00"))






(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ispell-dictionary "brasileiro")
 '(package-selected-packages '(auto-package-update use-package cmake-mode)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

I've looked up on Stack and Reddit about signature key but nothing worked.

I'm new to Emacs and started configuring it yesterday. And everything was going ok (show number lines, fonts, themes) but when I tried to install packages (MELPA) it keeps showing this.

MY OS: LINUX MINT 21.3

I'm getting this message when I start Emacs after configuring init.el: error: Package ‘use-package-’ is unavailable

EDIT: So I was trying to solve this and I learned that if just do this:

(require 'package)
(add-to-list 'package-archives
         '("melpa" . "https://melpa./packages/") t)
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

It works! The problem is when I try to install use-package. Then it returns:

Failed to verify signature: bind-key-2.4.1.tar.sig

My config is:

;; Configuração básica do Emacs
(setq inhibit-startup-message t)     ; Desabilita a tela inicial do Emacs

(tool-bar-mode -1)                   ; Oculta a barra de ferramentas
(menu-bar-mode -1)                   ; Oculta a barra de menu
(scroll-bar-mode -1)                 ; Oculta a barra de rolagem
(tooltip-mode -1)                    ; Oculta dicas

(global-display-line-numbers-mode t) ; Exibe numeração de linhas
(column-number-mode t)               ; Exibe coluna atual na modeline

;; Alertas visuais
(setq visible-bell t)

;; Espaçamento das bordas laterais
(set-fringe-mode 10)

;; Outros
(delete-selection-mode t)            ; O texto digitado substitui a seleção

;; Rolagem mais suave
(setq mouse-wheel-scroll-amount '(2 ((shift) . 1)) ; 2 linhas por vez
      mouse-wheel-progressive-speed nil            ; Não acelera a rolagem
      mouse-wheel-follow-mouse 't                  ; Rola a janela sob o mouse
      scroll-step 1)                               ; Rola 1 linha com teclado

;; Quebras de linha
(global-visual-line-mode t)

;; Organizando os backups
(setq backup-directory-alist '(("." . "~/.saves"))) 

;; Definição temporária do tema
(load-theme 'tango-dark t)

;; Fonte padrão
(set-face-attribute 'default nil :font "Monospace" :height 140)

;; Tipo de cursor
(setq-default cursor-type 'box)

;; Função para criar um novo buffer
(defun debmx-new-buffer ()
  "Cria um novo buffer 'sem nome'."
  (interactive)
  (let ((debmx/buf (generate-new-buffer "sem-nome")))
    (switch-to-buffer debmx/buf)
    (funcall initial-major-mode)
    (setq buffer-offer-save t)
    debmx/buf))

;; Modo inicial
(setq initial-major-mode 'prog-mode)
(setq initial-buffer-choice 'debmx-new-buffer)

;; Verifica e inicia o package.el
(require 'package)

;; Definição de repositórios
(setq package-archives '(("melpa" . "https://melpa./packages/")
                         ("elpa"  . "https://elpa.gnu./packages/")))

;; Inicialização do sistema de pacotes
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

; Instalação do use-package
(unless (package-installed-p 'use-package)
  (package-install 'use-package))
  
(require 'use-package)
(setq use-package-always-ensure t)

;; Instalação do auto-update

(use-package auto-package-update
  :custom
  (auto-package-update-interval 7)
  (auto-package-update-prompt-before-update t)
  (auto-package-update-hide-results t)
  :config
  (auto-package-update-maybe)
  (auto-package-update-at-time "21:00"))






(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ispell-dictionary "brasileiro")
 '(package-selected-packages '(auto-package-update use-package cmake-mode)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

I've looked up on Stack and Reddit about signature key but nothing worked.

Share Improve this question edited Mar 14 at 21:25 Drew 30.8k7 gold badges79 silver badges109 bronze badges asked Mar 14 at 16:47 Caio VitorCaio Vitor 11 bronze badge 0
Add a comment  | 

2 Answers 2

Reset to default 0

My start is - would be in your case:

(require 'package)

(setq package-enable-at-startup nil)
(setq package-archives '(("elpa"  . "https://elpa.gnu./packages/")
                         ("melpa" . "https://melpa./packages/")))
(package-initialize)
(package-refresh-contents)  ;; I always ensure package-refresh-contents at start

;; Bootstrap `use-package`
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(require 'use-package)
(setq use-package-always-ensure t)



;; load my-init.
(-babel-load-file (expand-file-name "~/.emacs.d/myinit."))



(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ispell-dictionary "brasileiro")
 '(package-selected-packages '(auto-package-update use-package cmake-mode)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(put 'downcase-region 'disabled nil)

Then in the same folder where is init.el, I place myinit. (which can then use -mode which looks better and one can with TAB fold and unfold parts of the script - very helpful to keep the overview). Usually the folder is ~/.emacs.d/. So myinit. would in your case contain:

#+STARTUP: overview hidestars indent align inlineimages

* Global Settings
  
  #+BEGIN_SRC emacs-lisp
;; Configuração básica do Emacs
(setq inhibit-startup-message t)     ; Desabilita a tela inicial do Emacs

(tool-bar-mode -1)                   ; Oculta a barra de ferramentas
(menu-bar-mode -1)                   ; Oculta a barra de menu
(scroll-bar-mode -1)                 ; Oculta a barra de rolagem
(tooltip-mode -1)                    ; Oculta dicas

(global-display-line-numbers-mode t) ; Exibe numeração de linhas
(column-number-mode t)               ; Exibe coluna atual na modeline

;; Alertas visuais
(setq visible-bell t)

;; Espaçamento das bordas laterais
(set-fringe-mode 10)

;; Outros
(delete-selection-mode t)            ; O texto digitado substitui a seleção

;; Rolagem mais suave
(setq mouse-wheel-scroll-amount '(2 ((shift) . 1)) ; 2 linhas por vez
      mouse-wheel-progressive-speed nil            ; Não acelera a rolagem
      mouse-wheel-follow-mouse 't                  ; Rola a janela sob o mouse
      scroll-step 1)                               ; Rola 1 linha com teclado

;; Quebras de linha
(global-visual-line-mode t)

;; Organizando os backups
(setq backup-directory-alist '(("." . "~/.saves"))) 

;; Definição temporária do tema
(load-theme 'tango-dark t)

;; Fonte padrão
(set-face-attribute 'default nil :font "Monospace" :height 140)

;; Tipo de cursor
(setq-default cursor-type 'box)

;; Função para criar um novo buffer
(defun debmx-new-buffer ()
  "Cria um novo buffer 'sem nome'."
  (interactive)
  (let ((debmx/buf (generate-new-buffer "sem-nome")))
    (switch-to-buffer debmx/buf)
    (funcall initial-major-mode)
    (setq buffer-offer-save t)
    debmx/buf))

;; Modo inicial
(setq initial-major-mode 'prog-mode)
(setq initial-buffer-choice 'debmx-new-buffer)
  #+END_SRC

* Auto Update

#+BEGIN_SRC emacs-lisp
;; Instalação do auto-update
(use-package auto-package-update
  :custom
  (auto-package-update-interval 7)
  (auto-package-update-prompt-before-update t)
  (auto-package-update-hide-results t)
  :config
  (auto-package-update-maybe)
  (auto-package-update-at-time "21:00"))
#+END_SRC

In this way, you can create section with the form:


* Section Title

#+BEGIN_SRC emacs-lisp
;; some emacs code starting always with
(use-package package-name
  :custom
  ;; some code)
#+END_SRC

The GPG keys have limited lifespans, and Emacs 27.1 is several years old, so that version no longer knows the valid keys.

You'll need to install the gnu-elpa-keyring-update package from GNU ELPA, and you'll probably need to temporarily disable package-check-signature in order to do that:

  • M-: (setq package-check-signature nil) RET
  • M-x package-refresh-contents RET
  • M-x package-install RET gnu-elpa-keyring-update RET

If you then restart Emacs, you'll probably find things are working.


I think this is effectively a duplicate of Emacs: Failed to verify signature archive-contents.sig, but maybe it's useful having this question mentioning that specific error, as use-package is quite a popular package.

发布评论

评论列表(0)

  1. 暂无评论