Emacs打开文件报错:无法激活‘evil’包,依赖‘goto-chg-1.6’缺失求助
I’ve run into similar dependency hiccups with Emacs packages before—let’s break down what’s likely going on and how to fix this step by step.
Possible Causes
Even if you didn’t modify your config or install new packages, here are common reasons this error pops up:
- Local package files for
goto-chg-1.6got corrupted, deleted, or lost permissions (maybe from a system cleanup or disk glitch). - Your Emacs package archive index is outdated, so it can’t locate the required version of
goto-chg. - The
goto-chgpackage was temporarily removed from your configured package repository (unlikely, but possible for older Emacs versions like 25.1).
Step-by-Step Solutions
1. Refresh Package Archives and Reinstall goto-chg
This is the most straightforward fix:
- Open Emacs and run
M-x package-refresh-contents—this updates the list of available packages from your configured archives. - Next, run
M-x package-install RET goto-chg RETto install the missing dependency. - Restart Emacs and try activating
evilagain.
2. Check for Corrupted/Deleted Local Package Files
If the first step doesn’t work, verify your local package directory:
- Navigate to your Emacs package folder (usually
~/.emacs.d/elpa/) and look for a folder namedgoto-chg-1.6.- If it’s missing: The reinstall step above should recreate it.
- If it exists but seems corrupted: Delete the folder entirely, then repeat the refresh/reinstall steps.
- Ensure the directory has proper permissions by running this in your terminal:
chmod -R 755 ~/.emacs.d/elpa/
3. Manually Install goto-chg If Package.el Can’t Find It
If package-install fails to locate goto-chg-1.6, you can install it manually:
- Grab the raw
goto-chg.elfile (version 1.6) and save it to a directory in your Emacs load path (like~/.emacs.d/lisp/). - Add this line to your init file (if not already present) to include the directory in your load path:
(add-to-list 'load-path "~/.emacs.d/lisp/") - Add
(require 'goto-chg)before the line that loadsevilin your config. - Alternatively, use
M-x package-install-file RETand select the downloadedgoto-chg.elfile to install it via Emacs’s package manager.
4. Verify Your Package Archives Include MELPA
goto-chg is hosted on MELPA, so if it’s not in your configured archives, Emacs can’t find it. Check if it’s listed by running M-x package-list-packages and looking at the top of the buffer. If not, add this to your init file:
(require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize)
Then run package-refresh-contents again and try reinstalling.
Note for Older Emacs Versions
Since you’re on Emacs 25.1 (a fairly old release), some packages might stop being supported in the main MELPA archive. If you run into recurring issues, consider switching to MELPA Stable by replacing the MELPA URL with https://stable.melpa.org/packages/—this hosts older, more stable versions of packages compatible with older Emacs releases.
内容的提问来源于stack exchange,提问作者UnSat

