I had a difficult time tracking this down, so I'm posting to help others who search for a similar error.
I decided to set up a new project on Ubuntu 18.04 in Atom with eslint and Node.js.
ESlint, by itself, installed and ran just fine with my config extending eslint:recommended
, but when I installed eslint-config-airbnb-base
and changed my config to extend airbnb-base
, I started getting an error in Atom and it would not parse my files.
Error while running ESLint: createRequire is not a function.
Removing airbnb and relying on eslint-plugin-import
gave a similar error:
Error while running ESLint: Failed to load plugin 'import' declared in '.eslintrc.yaml': createRequire is not a function.
However, running eslint on the command-line worked fine.
This is a compatibility issue.
This change to eslint removed a polyfill that supported node versions below v10.12.0
I was running Atom 1.45.0, which uses node v10.11.0
. Running eslint from the command line worked because I have node v12.18.2
installed there.
So you have two of options to fix the issue:
v12.0.0
). If that's not possible for you then...6.8.0
(the last release before 7.0.0). This version still contains the polyfill for createRequire
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With