Spacemacs载入报错: file-error

Description :octocat:

error: (file-error Cannot open load file No such file or directory dash)

不是很清楚这个dash是dash package还是说指目录的“/”

Reproduction guide :beetle:

  • Start Emacs
  • 进入Message buffer,检测到file-error

My personal spacemacs config: :heart: :smile:

System Info :computer:

  • OS: darwin
  • Emacs: 25.2.1
  • Spacemacs: 0.200.7
  • Spacemacs branch: develop (rev. c9d332f)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: ivy
  • Layers:
(version-control php ivy better-defaults github ranger colors prodigy search-engine graphviz
                 (syntax-checking :variables syntax-checking-enable-by-default nil syntax-checking-enable-tooltips nil)
                 (spell-checking :variables spell-checking-enable-by-default nil)
                 (vinegar :variables vinegar-reuse-dired-buffer t)
                 (spacemacs-layouts :variables layouts-enable-autosave nil layouts-autosave-delay 300)
                 (git :variables git-magit-status-fullscreen t magit-push-always-verify nil magit-save-repository-buffers 'dontask magit-revert-buffers 'silent magit-refs-show-commit-count 'all magit-revision-show-gravatars nil)
                 (ibuffer :variables ibuffer-group-buffers-by 'projects)
                 (auto-completion :variables auto-completion-enable-sort-by-usage t auto-completion-enable-snippets-in-popup t :disabled-for org markdown)
                 (osx :variables osx-dictionary-dictionary-choice "Simplified Chinese - English")
                 restclient
                 (gtags :disabled-for clojure emacs-lisp javascript latex python shell-scripts)
                 (shell :variables shell-default-shell 'eshell)
                 docker deft markdown org shaders yaml react
                 (python :variables python-test-runner
                         '(nose pytest))
                 (ruby :variables ruby-version-manager 'chruby)
                 ruby-on-rails lua html javascript
                 (typescript :variables typescript-fmt-on-save nil typescript-fmt-tool 'typescript-formatter)
                 emacs-lisp
                 (clojure :variables clojure-enable-fancify-symbols t)
                 racket
                 (c-c++ :variables c-c++-default-mode-for-headers 'c++-mode)
                 zilongshanren ztlevi
                 (chinese :packages youdao-dictionary fcitx :variables chinese-enable-fcitx nil chinese-enable-youdao-dict t))
  • System configuration features: NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS

Backtrace :paw_prints:

<<BACKTRACE IF RELEVANT>>

应该是指 dash package,这个貌似很常用的一个库,很多包都有这个依赖

我和你一样,已经很久了。一直没去管。话说我的启动报错好多啊。。

求教如何解决啊,我安装了dash还是没用诶,在package-list-packages,和init.el里都试过了

emacs --debug-init 再跑一边,贴详细日志,不要截图。

有可能是你缓存的包版本信息是旧的,跟实际安装的不一样。

每次都是在terminal下打开的,不知道怎么copy诶。。。只能截图

能复制了。。。 Debugger entered–Lisp error: (void-variable spacemacs//init-company-json-mode) (flycheck-mode spacemacs//init-company-json-mode company-mode) (lambda nil (flycheck-mode spacemacs//init-company-json-mode company-mode))() eval-after-load(flycheck (flycheck-mode spacemacs//init-company-json-mode company-mode)) ztlevi-programming/post-init-flycheck() funcall(ztlevi-programming/post-init-flycheck) (condition-case err (funcall (intern (format “%S/post-init-%S” layer pkg-name))) ((debug quote error) (configuration-layer//increment-error-count) (spacemacs-buffer/append (format (concat “\nAn error occurred while post-configuring %S " “in layer %S (error: %s)\n”) pkg-name layer err)))) (if (not (configuration-layer//package-enabled-p pkg layer)) (spacemacs-buffer/message (format " -> ignored post-init (%S)…” layer)) (spacemacs-buffer/message (format " -> post-init (%S)…" layer)) (condition-case err (funcall (intern (format “%S/post-init-%S” layer pkg-name))) ((debug quote error) (configuration-layer//increment-error-count) (spacemacs-buffer/append (format (concat “\nAn error occurred while post-configuring %S " “in layer %S (error: %s)\n”) pkg-name layer err))))) (progn (if (not (configuration-layer//package-enabled-p pkg layer)) (spacemacs-buffer/message (format " -> ignored post-init (%S)…” layer)) (spacemacs-buffer/message (format " -> post-init (%S)…" layer)) (condition-case err (funcall (intern (format “%S/post-init-%S” layer pkg-name))) ((debug quote error) (configuration-layer//increment-error-count) (spacemacs-buffer/append (format (concat “\nAn error occurred while post-configuring %S " “in layer %S (error: %s)\n”) pkg-name layer err)))))) (if (configuration-layer/layer-usedp layer) (progn (if (not (configuration-layer//package-enabled-p pkg layer)) (spacemacs-buffer/message (format " -> ignored post-init (%S)…” layer)) (spacemacs-buffer/message (format " -> post-init (%S)…" layer)) (condition-case err (funcall (intern (format “%S/post-init-%S” layer pkg-name))) ((debug quote error) (configuration-layer//increment-error-count) (spacemacs-buffer/append (format (concat “\nAn error occurred while post-configuring %S " “in layer %S (error: %s)\n”) pkg-name layer err))))))) (lambda (layer) (if (configuration-layer/layer-usedp layer) (progn (if (not (configuration-layer//package-enabled-p pkg layer)) (spacemacs-buffer/message (format " -> ignored post-init (%S)…” layer)) (spacemacs-buffer/message (format " -> post-init (%S)…" layer)) (condition-case err (funcall (intern (format “%S/post-init-%S” layer pkg-name))) ((debug quote error) (configuration-layer//increment-error-count) (spacemacs-buffer/append (format … pkg-name layer err))))))))(ztlevi-programming) mapc((lambda (layer) (if (configuration-layer/layer-usedp layer) (progn (if (not (configuration-layer//package-enabled-p pkg layer)) (spacemacs-buffer/message (format " -> ignored post-init (%S)…" layer)) (spacemacs-buffer/message (format " -> post-init (%S)…" layer)) (condition-case err (funcall (intern (format “%S/post-init-%S” layer pkg-name))) ((debug quote error) (configuration-layer//increment-error-count) (spacemacs-buffer/append (format … pkg-name layer err)))))))) (ztlevi-programming zilongshanren-programming c-c++ emacs-lisp typescript lua ruby python javascript html react yaml php)) (let* ((pkg-name (eieio-oref pkg (quote :name))) (owner (car (eieio-oref pkg (quote :owners))))) (spacemacs-buffer/message (format “Configuring %S…” pkg-name)) (mapc (function (lambda (layer) (if (configuration-layer/layer-usedp layer) (progn (if (not …) (spacemacs-buffer/message …) (spacemacs-buffer/message …) (condition-case err … …)))))) (eieio-oref pkg (quote :pre-layers))) (spacemacs-buffer/message (format " -> init (%S)…" owner)) (funcall (intern (format “%S/init-%S” owner pkg-name))) (mapc (function (lambda (layer) (if (configuration-layer/layer-usedp layer) (progn (if (not …) (spacemacs-buffer/message …) (spacemacs-buffer/message …) (condition-case err … …)))))) (eieio-oref pkg (quote :post-layers)))) configuration-layer//configure-package([eieio-class-tag–cfgl-package flycheck nil (syntax-checking) nil (ztlevi-programming zilongshanren-programming c-c++ emacs-lisp typescript lua ruby python javascript html react yaml php) elpa t nil nil nil nil]) (cond ((eq (quote dotfile) (car (eieio-oref pkg (quote :owners)))) (spacemacs-buffer/message (format “%S is configured in the dotfile.” pkg-name))) (t (configuration-layer//configure-package pkg))) (cond ((eieio-oref pkg (quote :lazy-install)) (spacemacs-buffer/message (format “%S ignored since it can be lazily installed.” pkg-name))) ((and (eieio-oref pkg (quote :excluded)) (not (eieio-oref pkg (quote :protected)))) (spacemacs-buffer/message (format “%S ignored since it has been excluded.” pkg-name))) ((null (eieio-oref pkg (quote :owners))) (spacemacs-buffer/message (format “%S ignored since it has no owner layer.” pkg-name))) ((not (cfgl-package-enabledp pkg)) (spacemacs-buffer/message (format “%S is toggled off.” pkg-name))) (t (let ((dir (configuration-layer/get-location-directory pkg-name (eieio-oref pkg (quote :location)) (car (eieio-oref pkg …))))) (if dir (progn (add-to-list (quote load-path) dir)))) (if (memq (eieio-oref pkg (quote :location)) (quote (local site built-in))) nil (configuration-layer//activate-package pkg-name)) (cond ((eq (quote dotfile) (car (eieio-oref pkg (quote :owners)))) (spacemacs-buffer/message (format “%S is configured in the dotfile.” pkg-name))) (t (configuration-layer//configure-package pkg))))) (let ((pkg (configuration-layer/get-package pkg-name))) (cond ((eieio-oref pkg (quote :lazy-install)) (spacemacs-buffer/message (format “%S ignored since it can be lazily installed.” pkg-name))) ((and (eieio-oref pkg (quote :excluded)) (not (eieio-oref pkg (quote :protected)))) (spacemacs-buffer/message (format “%S ignored since it has been excluded.” pkg-name))) ((null (eieio-oref pkg (quote :owners))) (spacemacs-buffer/message (format “%S ignored since it has no owner layer.” pkg-name))) ((not (cfgl-package-enabledp pkg)) (spacemacs-buffer/message (format “%S is toggled off.” pkg-name))) (t (let ((dir (configuration-layer/get-location-directory pkg-name (eieio-oref pkg …) (car …)))) (if dir (progn (add-to-list (quote load-path) dir)))) (if (memq (eieio-oref pkg (quote :location)) (quote (local site built-in))) nil (configuration-layer//activate-package pkg-name)) (cond ((eq (quote dotfile) (car (eieio-oref pkg …))) (spacemacs-buffer/message (format “%S is configured in the dotfile.” pkg-name))) (t (configuration-layer//configure-package pkg)))))) (while --dolist-tail-- (setq pkg-name (car --dolist-tail–)) (spacemacs-buffer/loading-animation) (let ((pkg (configuration-layer/get-package pkg-name))) (cond ((eieio-oref pkg (quote :lazy-install)) (spacemacs-buffer/message (format “%S ignored since it can be lazily installed.” pkg-name))) ((and (eieio-oref pkg (quote :excluded)) (not (eieio-oref pkg (quote :protected)))) (spacemacs-buffer/message (format “%S ignored since it has been excluded.” pkg-name))) ((null (eieio-oref pkg (quote :owners))) (spacemacs-buffer/message (format “%S ignored since it has no owner layer.” pkg-name))) ((not (cfgl-package-enabledp pkg)) (spacemacs-buffer/message (format “%S is toggled off.” pkg-name))) (t (let ((dir (configuration-layer/get-location-directory pkg-name … …))) (if dir (progn (add-to-list … dir)))) (if (memq (eieio-oref pkg (quote :location)) (quote (local site built-in))) nil (configuration-layer//activate-package pkg-name)) (cond ((eq (quote dotfile) (car …)) (spacemacs-buffer/message (format “%S is configured in the dotfile.” pkg-name))) (t (configuration-layer//configure-package pkg)))))) (setq --dolist-tail-- (cdr --dolist-tail–))) (let ((–dolist-tail-- packages) pkg-name) (while --dolist-tail-- (setq pkg-name (car --dolist-tail–)) (spacemacs-buffer/loading-animation) (let ((pkg (configuration-layer/get-package pkg-name))) (cond ((eieio-oref pkg (quote :lazy-install)) (spacemacs-buffer/message (format “%S ignored since it can be lazily installed.” pkg-name))) ((and (eieio-oref pkg (quote :excluded)) (not (eieio-oref pkg …))) (spacemacs-buffer/message (format “%S ignored since it has been excluded.” pkg-name))) ((null (eieio-oref pkg (quote :owners))) (spacemacs-buffer/message (format “%S ignored since it has no owner layer.” pkg-name))) ((not (cfgl-package-enabledp pkg)) (spacemacs-buffer/message (format “%S is toggled off.” pkg-name))) (t (let ((dir …)) (if dir (progn …))) (if (memq (eieio-oref pkg …) (quote …)) nil (configuration-layer//activate-package pkg-name)) (cond ((eq … …) (spacemacs-buffer/message …)) (t (configuration-layer//configure-package pkg)))))) (setq --dolist-tail-- (cdr --dolist-tail–)))) configuration-layer//configure-packages-2((4clojure abbrev ac-ispell ace-jump-helm-line ace-jump-mode ace-link ace-window adaptive-wrap aggressive-indent all-the-icons all-the-icons-dired anaconda-mode ansi-colors archive-mode auto-compile auto-complete auto-dictionary auto-highlight-symbol auto-yasnippet avy bookmark bracketed-paste bundler cc-mode centered-buffer-mode centered-cursor chruby cider cider-eval-sexp-fu clang-format clean-aindent-mode clj-refactor clojure-mode clojure-snippets cmake-font-lock cmake-mode coffee-mode color-identifiers-mode column-enforce-mode comint company company-anaconda company-c-headers company-glsl company-quickhelp company-restclient company-statistics company-tern company-web conf-mode …)) configuration-layer//configure-packages((4clojure abbrev ac-ispell ace-jump-helm-line ace-jump-mode ace-link ace-window adaptive-wrap aggressive-indent all-the-icons all-the-icons-dired anaconda-mode ansi-colors archive-mode async auto-compile auto-complete auto-dictionary auto-highlight-symbol auto-yasnippet avy bind-key bind-map bookmark bracketed-paste bundler cc-mode centered-buffer-mode centered-cursor chruby cider cider-eval-sexp-fu clang-format clean-aindent-mode clj-refactor clojure-mode clojure-snippets cmake-font-lock cmake-mode coffee-mode color-identifiers-mode column-enforce-mode comint company company-anaconda company-c-headers company-glsl company-quickhelp company-restclient company-statistics …)) configuration-layer/sync() (if (not (version<= spacemacs-emacs-min-version emacs-version)) (error (concat “Your version of Emacs (%s) is too old. " “Spacemacs requires Emacs version %s or above.”) emacs-version spacemacs-emacs-min-version) (load-file (concat (file-name-directory load-file-name) “core/core-load-paths.el”)) (require (quote core-spacemacs)) (spacemacs/init) (configuration-layer/sync) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (require (quote server)) (if (server-running-p) nil (server-start))) eval-buffer(#<buffer load> nil “/Users/ztlevi/.emacs.d/init.el” nil t) ; Reading at buffer position 1264 load-with-code-conversion(”/Users/ztlevi/.emacs.d/init.el" “/Users/ztlevi/.emacs.d/init.el” t t) load("/Users/ztlevi/.emacs.d/init" t t) #0 “\205\266 \306=\203\307\310Q\202? \311=\204\307\312Q\202?\313\307\314\315#\203*\316\202?\313\307\314\317#\203>\320\321\322!D\nB\323\202?\316\324\325\324\211#\210\324=\203e\326\327\330\307\331Q!”\325\324\211#\210\324=\203d\210\203\247\332!\333\232\203\247\334!\211\335P\336!\203\201\211\202\214\336!\203\213\202\214\314\262\203\245\337“\203\243\340\341#\210\342\343!\210\266\f?\205\264\314\325\344\324\211#)\262\207” [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos “~” “/_emacs” windows-nt “/.emacs” directory-files nil “^\.emacs\(\.elc?\)?$” “~/.emacs” “^_emacs\(\.elc?\)?$” initialization format-message “_emacs' init file is deprecated, please use.emacs’” “~/_emacs” t load expand-file-name “init” file-name-as-directory “/.emacs.d” file-name-extension “elc” file-name-sans-extension “.el” file-exists-p file-newer-than-file-p message “Warning: %s is newer than %s” sit-for 1 “default”] 7 command-line() normal-top-level()

最好还是到 spacemacs 的 issue tracker 看看有没有类似的问题,没有的话你提交一个。

排错没有什么技巧,就是看错误提示。你这里出错的是:

spacemacs//init-company-json-mode

在 ~/.emacs.d 里面找,看它有没有定义、在哪里调用。不一定是真正的错误原因所在,但是你把它解决了就可以向前一步。

好像是我自己的配置有问题,在这里:

(defun ztlevi-programming/post-init-flycheck()
  (eval-after-load 'flycheck
    (progn
      ;; use web-mode for .jsx files
      (add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode))

      ;; disable jshint since we prefer eslint checking
      (setq-default flycheck-disabled-checkers
                    (append flycheck-disabled-checkers
                            '(javascript-jshint)))

      ;; use eslint with web-mode for jsx files
      (flycheck-add-mode 'javascript-eslint 'web-mode)

      ;; customize flycheck temp file prefix
      (setq-default flycheck-temp-prefix ".flycheck")

      ;; disable json-jsonlist checking for json files
      (setq-default flycheck-disabled-checkers
                    (append flycheck-disabled-checkers
                            '(json-jsonlist)))

      ;; https://github.com/purcell/exec-path-from-shell
      ;; only need exec-path-from-shell on OSX
      ;; this hopefully sets up path and other vars better
      (when (memq window-system '(mac ns))
        (exec-path-from-shell-initialize))

      ;; for better jsx syntax-highlighting in web-mode
      ;; - courtesy of Patrick @halbtuerke
      (defadvice web-mode-highlight-part (around tweak-jsx activate)
        (if (equal web-mode-content-type "jsx")
            (let ((web-mode-enable-part-face nil))
              ad-do-it)
          ad-do-it))

      ;; c++
      (add-hook 'c++-mode-hook (lambda () (setq flycheck-gcc-language-standard "c++11")))

      ;; Enable for other modes
      (add-hook 'c++-mode-hook 'flycheck-mode)
      (add-hook 'web-mode-hook 'flycheck-mode)
      ;; (add-hook 'json-mode-hook 'flycheck-mode)
      ))
  )

去掉这个配置就不会报错了,然后把(add-hook json-mode-hook ‘flycheck-mode)去掉,就变成下面的报错了。

Debugger entered–Lisp error: (void-variable turn-on-evil-matchit-mode) (flycheck-mode turn-on-evil-matchit-mode emmet-mode drupal-mode-bootstrap spacemacs//init-company-web-mode spacemacs//init-company-vars-web-mode company-mode) (lambda nil (flycheck-mode turn-on-evil-matchit-mode emmet-mode drupal-mode-bootstrap spacemacs//init-company-web-mode spacemacs//init-company-vars-web-mode company-mode))() eval-after-load(flycheck (flycheck-mode turn-on-evil-matchit-mode emmet-mode drupal-mode-bootstrap spacemacs//init-company-web-mode spacemacs//init-company-vars-web-mode company-mode)) ztlevi-programming/post-init-flycheck() funcall(ztlevi-programming/post-init-flycheck)

求教下下面这段代码应该放在那里

;; c++
      (add-hook 'c++-mode-hook (lambda () (setq flycheck-gcc-language-standard "c++11")))

      ;; Enable for other modes
      (add-hook 'c++-mode-hook 'flycheck-mode)
      (add-hook 'web-mode-hook 'flycheck-mode)
      ;; (add-hook 'json-mode-hook 'flycheck-mode)
      ))

我放在ztlevi-programming layer里的config.el,并没有生效,post-init-flycheck里也不行,只有init.el里才可以。。求教为什么啊,。。

  1. 虽然 spacemacs 很方便,但是也要适当的了解一下它的加载过程:

    https://github.com/syl20bnr/spacemacs/wiki/Loading-process-guide

    而不是撞大运一样,把配置贴在某个地方,不生效再换个地方。

  2. 你这里提到的 post-init-xxx,顾名思义,post 就是后执行的意思,单词都认得,但是不要忽视。

    在 flycheck 初始化之后,再配置语言 mode,告诉语言 mode,在它们各自加载的时候,启动 flycheck。这就是个蛋生鸡的问题了。为什么放在 init.el 里就有效,原因也在这里。

  3. 我上边对于 post-init-xxx 理解可能不准确,只是粗略地看了一下文档,但是大概思路因该是对的,你可以通过 (message ...) 打印 log 来观察(/验证)函数(/文件)的执行顺序。

对对,我一开始没注意这个,后面发现应该是放到config.el或者package.el里面都行,测试的时候we b-mode启动有问题,所以一直不成功,但其实json-mode和c+±mode都成功了。 我先在的web-mode 启动不了,启动时候弹出错误。 img 对于web-mode,我把(add-hook 'web-mode-hook 'flycheck-mode)加到intel.el里面是可以在启动web-mode(虽然是无法启动的)的时候默认启动flycheck-mode的,但是加到自己配置的layer的config.el里就不行了,我看了一下emacs启动时候的调用,init.el是在一开始就调用了,文档里说:dotspacemacs/user-init is called immediately after dotspacemacs/init, before layer configuration. 求教为什么我写在dotspacemacs/user-init()里面的(add-hook 'web-mode-hook 'flycheck-mode)生效了呢。。 谢谢啦

不好意思啊,搞了半天web-mode的问题,重启了一下机子就没有了。。。。mac不怎么重启,除非实在想要重启。。rip