reddit / emacs

How to fix following Error error: Package ‘use-package-’ is unavailable ?

Riffle_X · 2022-07-19 14:09
So I am following this tutorial [https://www.youtube.com/watch?v=74zOY-vgkyw&list=PLEoMzSkcN8oPH1au7H6B7bBJ4ZO7BXjSZ&index=3&t=220s](https://www.youtube.com/watch?v=74zOY-vgkyw&list=PLEoMzSkcN8oPH1au7H6B7bBJ4ZO7BXjSZ&index=3&t=220s) and I have been receiving the error mentioned in the title. I tried searching it up to see if I could find any solutions and the only thing I could find suggested that I run the following command `M-x package-refresh-contents` which gave me a new error `Failed to download 'elpa' archive` I tried looking this error up online but I couldn't find a clear solution. This is the config I am using (setq inhibit-startup-message t) (tooltip-mode -1) ; relegate tooltips to echo area only (menu-bar-mode -1) ; disable the menu bar (if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) ; disable the toolbar (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) ; disable visible scrollbar (menu-bar-mode -1) ; Disable the menu bar ;; Set up the visible bell (setq ring-bell-function #'ignore visible-bell nil) (add-to-list 'default-frame-alist '(fullscreen . maximized)) (set-face-attribute 'default nil :height 150) (load-theme 'tango-dark) ;; Initialize package sources (require 'package) (setq package-archives '(("melpa", "https://melpa.org/packages/") ("org", "https://orgmode.org/elpa/") ("elpa", "https://elpa.gnu.org/packages/"))) (package-initialize) (unless package-archive-contents (package-refresh-contents)) ;; Intialize package on non linux platforms (unless (package-installed-p 'use-package) (package-install 'use-package)) (require 'use-package) (setq use-package-always-ensure t) Also not sure if this helps but I am on a M1 Mac running Monterey and I am using GNU Emacs 28.1
nicholas_hubbard · 2022-07-19 17:35
This config loads fine for me on Emacs 27.2. In the post title I see that your error is `error: Package ‘use-package-’ is unavailable`, which shows that you are trying to load the package `use-package-` (note the extra hyphen). Do you have a typo in your config where you are trying to load `use-package-`?
organic-bookworm · 2022-07-20 09:53
The [`package-archives`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Package-Archives.html#index-package_002darchives) is an alist of `(id . location)` conses. Change (setq package-archives '(("melpa", "https://melpa.org/packages/") ("org", "https://orgmode.org/elpa/") ("elpa", "https://elpa.gnu.org/packages/"))) To (setq package-archives '(("melpa" . "https://melpa.org/packages/") ("org" . "https://orgmode.org/elpa/") ("elpa" . "https://elpa.gnu.org/packages/")))