Emacs Asked by Ben.krck on September 2, 2021
After following the installation instructions I received this error:
javascript-eslint (disabled)
- may enable: Automatically disabled!
- executable: Found at /Users/ben/programming/eslint_test/node_modules/eslint/bin/eslint.js
- config file: missing or incorrect
I have tried many things, yet nothing worked. Out of desperation I reinstalled my MacOS in the hope that a fresh install would fix things.
My steps:
main.js
, with eslint init
)C-c ! v
in the main.js
buffereslint main.js
-> successeslint --describe-config main.js
-> successRunning M-x describe-variable RET exec-path
returns:
Its value is
("/usr/local/bin/" "/usr/bin/" "/bin/" "/usr/sbin/" "/sbin/" "/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14/" "/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_14/" "/Applications/Emacs.app/Contents/MacOS/libexec/")
Original value was
("/usr/local/bin" "/usr/bin" "/bin" "/usr/sbin" "/sbin" "/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14" "/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_14" "/Applications/Emacs.app/Contents/MacOS/libexec")
My config file:
(require 'package)
(add-to-list 'package-archives
'("MELPA Stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(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.
'(package-selected-packages (quote (exec-path-from-shell js2-mode web-mode flycheck))))
(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.
)
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
;; turn on flychecking globally
(add-hook 'after-init-hook #'global-flycheck-mode)
;; use local eslint from node_modules before global
;; http://emacs.stackexchange.com/questions/21205/flycheck-with-file-relative-eslint-executable
(defun my/use-eslint-from-node-modules ()
(let* ((root (locate-dominating-file
(or (buffer-file-name) default-directory)
"node_modules"))
(eslint (and root
(expand-file-name "node_modules/eslint/bin/eslint.js"
root))))
(when (and eslint (file-executable-p eslint))
(setq-local flycheck-javascript-eslint-executable eslint))))
(add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)
No google search led me in the right direction. I tried this with a global eslint, and with a local one. Both fail.
Eslint version: 7.4.0
run command eslint --print-config ./xxx.js
to see what cause the error
Answered by user3113626 on September 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP