Following the instructions located at https://packagecontrol.io/packages/ESLint, I installed Node.JS, then installed ESLint, then opened Sublime Text Editor and used the Command Palette to install the ESLint package per the instructions. But when I try to lint a javascript file using CTRL-ALT-E, I get the following error message in my sublime text console stating it cannot find the file ESLint. It's acting as if the program is not installed even though I can clearly see ESLint commands listed in Sublime text's Package Settings and Tools menu, including the option to lint the open file.
Here is the error message I receive in Sublime Text console:
node:internal/modules/cjs/loader:1078
throw err;
^
Error: Cannot find module 'eslint'
Require stack:
- C:\Users\Dennis\AppData\Roaming\Sublime Text 3\Packages\ESLint\linter.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
at Function.resolve (node:internal/modules/cjs/helpers:116:19)
at Object.<anonymous> (C:\Users\Dennis\AppData\Roaming\Sublime Text 3\Packages\ESLint\linter.js:19:13)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Dennis\\AppData\\Roaming\\Sublime Text 3\\Packages\\ESLint\\linter.js'
]
}
Node.js v18.16.0
[Finished in 113ms]
This is after the second time I've uninstalled Node and reinstalled it, then tried reinstalling ESLint, and Sublime Text's ESLint plugin per the instructions above. At this point I don't know where to start troubleshooting.
I am using sublime build 4143, and sublime update function confirms this is the latest version.
Expected to run ESLint in sublime and get syntax highlighting for any code that does not conform to Sublime's default syntax rules.
Update on steps taken to address. Following suggestion to configure node_path settings for the sublime text plugin, I opened Sublime, went to the menu preferences -> Package Settings -> ESLine -> Settings-User, and changed the ESLint.sublime-settings--User file as follows:
// The directory location of your `node` executable lives. If this is not
// specified, then it is expected to be on Sublime's environment path.
//
// On OSX, for example: "/usr/local/bin"
// Example for nodebrew: "$HOME/.nodebrew/current/bin"
// Example for Windows: "C:/Program Files/nodejs"
"node_path": "C:/Program Files/nodejs"
That is where my node executable and folder is, while Sublime Text is actually located on my other hard drive, E:
I tried closing sublime and reopening it and running ESLint in sublime still gives same error.