question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`yarn lint` not working on brand new app

See original GitHub issue

What version of Next.js are you using?

11.1.2

What version of Node.js are you using?

16.6.1

What browser are you using?

Edge 94

What operating system are you using?

Windows 11 (Insider build: 22000.258)

How are you deploying your application?

next start

Describe the Bug

When I create a brand new app using yarn create next-app, and try to run yarn lint, an error is thrown:

image

I wanted to try out linting cause apparently Im a bad developer for not doing so and I don’t know what I’m doing wrong.

Expected Behavior

I would have expected it to lint my app

To Reproduce

  1. Create a brand new app using yarn create next-app
  2. Run next lint in the app directory

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
gaston-florescommented, Oct 17, 2021

I think this is related to a change in eslint’s package.json. They added this field:

  "exports": {
    "./package.json": "./package.json",
    ".": "./lib/api.js",
    "./use-at-your-own-risk": "./lib/unsupported-api.js"
  },

Which causes the require in hasNecessaryDependencies to throw this error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/api.js' is not defined by "exports" in C:\Users\user\Repos\eslint-bug-test\node_modules\eslint\package.json

Removing the exports field manually from eslint’s package.json also fixes this issue.

1reaction
housseindjirdehcommented, Oct 18, 2021

Closing as this is a duplicate. Like others mentioned, you’ll need to downgrade to v7 for the meantime.

There’s an open PR to add support for v8 (#29865). Once all sub-dependencies used in Next.js’ ESLint config and plugin is supported, it’ll be merged!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Command yarn lint not working when init a new project #27695
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: npm install @react-native-community/eslint- ...
Read more >
Troubleshooting a Next.js app with ESLint - LogRocket Blog
Inside your Next.js app, add a new script called lint — its value should be next lint : "scripts" : { ... "lint":...
Read more >
error Command failed with exit code 1. when I try to run yarn
what you need to do is just simple: follow these steps: rm -rf node_modules; yarn cache clean; yarn; yarn start.
Read more >
ESLint not working in VSCode? Help build a troubleshooting ...
Take a look into your eslintrc configuration file and make a list of all plugins and presets. Than make sure, they as well...
Read more >
User Guide | eslint-plugin-vue
If you have issues with these, please also refer to the FAQ. ... That means you can just run yarn lint or npm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found