0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Sublime Text】SublimeLinter エラー "env: node: No such file or directory" の解決

Last updated at Posted at 2020-01-14

発生した環境、状況

  • Mac (シェルスクリプトは zsh)
  • node.js は node brew で動かしている
  • ~/.zshrc で node へのパスは設定済み (export PATH=$HOME/.nodebrew/current/bin:$PATH)
  • bash → zsh 移行、node 本体のアップデート、node パッケージのアップデート などを行った後に発生 (原因は特定できていない)

エラー内容

JavaScript ファイルを開くと、ウインドウ下部に下記のエラーメッセージが出て、SublimeLinter が正常に機能しない

SublimeLinter: #5 eslint gulpfile.babel.js ERROR:
=================================================

env: node: No such file or directory

解決方法

SublimeLinter パッケージの設定で、node へのパスを指定してやることで解決した

// SublimeLinter Settings - User
{
    "linters": {
        "eslint": {
            "env": {"PATH":"~/.nodebrew/current/bin"}
        }
    }
}

他パッケージでも同様のエラーが出る場合、ここに設定を追加すれば解決するはず。
(例:sass-lint なら "sass":{"env": {"PATH":"/usr/local/bin/"}} を追記)

他の解決法

.zprofile でPATHを通しとく方法もある。こっちの方がいいか?
SublimeLinter-eslintでauto fixする | tsuyuki.makoto

メモ

  • .eslintrc と .sublime-project の内容を合わせておく
  • 設定ファイルのファイルネーム .eslintrc (中身は JSON) は現在は非推奨で、今は .eslintrc.json と書くらしい。でも変更するとエラーが出たので、.eslintrc ままにした(TODO:解決)

参考リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?