I tried downloading and running a Vue.js project from GitHub that was sent to me, but as soon as I tried npm run serve
, I got the following error:
Syntax Error: Error: No ESLint configuration found in C:\Users\User\Desktop\movies-main\src.
I ran npm install
too beforehand. I've create a couple of Vue.js projects myself and have never had this error so I'm not sure how to solve it. Could I be missing a dependency on my machine or something? I haven't used ESLint before.
I tried downloading and running a Vue.js project from GitHub that was sent to me, but as soon as I tried npm run serve
, I got the following error:
Syntax Error: Error: No ESLint configuration found in C:\Users\User\Desktop\movies-main\src.
I ran npm install
too beforehand. I've create a couple of Vue.js projects myself and have never had this error so I'm not sure how to solve it. Could I be missing a dependency on my machine or something? I haven't used ESLint before.
5 Answers
Reset to default 8Open your project folder. Then run the following command
npm install eslint -g -D
Then finish by typing :
eslint --init
Solve the problem for me.
Or use the locally installed eslint
npm init @eslint/config
I was getting this error after symlinking an NPM library via npm link
in the library directory followed by npm link <library name>
in the consuming Vue+Vite application.
Vite may be important information because the error stemmed from vite-plugin-eslint
.
I fixed it by passing in include
key for the eslint options:
vite.config.js
import eslint from 'vite-plugin-eslint';
import path from 'path';
// side note: `path` might require node v16+ due to `node:path` import
...
export default defineConfig({
plugins: [
eslint({
// without explicit path resolve, eslint tries to lint external directories symlinked via `npm link`
include: [
`${path.resolve(__dirname, '')}/**/*.js`,
`${path.resolve(__dirname, '')}/**/*.vue`,
],
}),
If you look at the docs, you'll see the default eslint()
with no options passed in (as recommended by their plugin) causes include: ['**/*.ext'],
so the solution here is to change **/
to /explicit/path/to/root/of/your/project/
.
In hypothesis, you could also use the exclude
key of the eslint options and stop it from trying to lint external folders, but I don't prefer that solution in case of multiple developers because you cannot predict their directory structure.
according to the document of eslint Open the root of your project then use this command:
npm init @eslint/config
it will create an eslintrc
in the root of the project. this way helped me to solve the problem.
Without installing eslint use npx
npx eslint --init
.eslintrc.js
– Serg Commented Feb 15, 2021 at 22:14