You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Fedora下Emacs安装Flycheck遇问题求助:无package-install等命令

Fixing Flycheck Installation Issues on Fedora's Latest Emacs

Hey there, let's get this sorted out—no need to spend more hours stuck on this! Let's break down the problems you're facing and fix them step by step:

1. Stop modifying system-wide Emacs files first

You mentioned editing /usr/share/emacs/site-lisp/site-start.d/desktop-entry-mode-init.el—don't do that! System files get overwritten when Emacs or Fedora updates, and your changes will be lost. All your personal Emacs config should live in your user directory, which is why we'll create your own init file next.

2. Create your personal Emacs init file

The ~/.emacs.d/init.el file doesn't exist by default—you have to make it yourself. Open a terminal and run this command to create it:

touch ~/.emacs.d/init.el

This will create an empty init file where you can safely add all your custom configurations.

3. Enable package.el (so you can use package-install/list-packages)

Fedora's default Emacs setup might not have package.el (the built-in package manager) enabled out of the box. Add these lines to your new ~/.emacs.d/init.el file to set it up:

;; Enable package.el
(require 'package)
;; Add package repositories
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
;; Initialize package.el
(package-initialize)
;; Refresh package contents if needed
(unless package-archive-contents
  (package-refresh-contents))

Save the file, then restart Emacs. Now when you press Alt-x (or ESC : followed by the command name), you should see package-install and list-packages available.

4. Install Flycheck

Once package.el is working, installing Flycheck is straightforward:

  • Press Alt-x, type package-install, hit Enter.
  • When prompted, type flycheck and hit Enter. Emacs will download and install the package for you.

Alternatively, you can use list-packages:

  • Press Alt-x, type list-packages, hit Enter.
  • Search for flycheck (use C-s to search), mark it for installation with i, then press x to execute the installation.

5. Enable Flycheck automatically

To make sure Flycheck starts every time you open Emacs, add these lines to your ~/.emacs.d/init.el file:

;; Enable Flycheck globally
(require 'flycheck)
(add-hook 'after-init-hook #'global-flycheck-mode)

Save the file and restart Emacs—Flycheck should now be active whenever you open a supported file type (like Python, JavaScript, etc.).

That should get you up and running with Flycheck! Let me know if you run into any snags along the way.

内容的提问来源于stack exchange,提问作者Jose Luis Flores Aguirre

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:44:10