Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: (Error running eslint init) #15512

Closed
1 task done
cek333 opened this issue Jan 12, 2022 · 4 comments
Closed
1 task done

Bug: (Error running eslint init) #15512

cek333 opened this issue Jan 12, 2022 · 4 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly repro:needed
Projects

Comments

@cek333
Copy link

cek333 commented Jan 12, 2022

Environment

Node version: v14.17.3
npm version: 6.14.8
Local ESLint version: installed by eslint --init
Global ESLint version: Installed via npm -g? None
Operating System: Win 10

What parser are you using?

Other

What did you do?

First I created a new project:

npm init -y

Then I installed eslint:

npm install --save-dev eslint

Then setup eslint:

npx eslint --init

Configuration
√ How would you like to use ESLint? · style
√ What type of modules does your project use? · esm
√ Which framework does your project use? · react
√ Does your project use TypeScript? · No
√ Where does your code run? · browser
√ How would you like to define a style for your project? · guide
√ Which style guide do you want to follow? · standard
√ What format do you want your config file to be in? · JavaScript
Checking peerDependencies of eslint-config-standard@latest
The config that you've selected requires the following dependencies:

eslint-plugin-react@latest eslint-config-standard@latest eslint@^7.12.1 eslint-plugin-import@^2.22.1 eslint-plugin-node@^11.1.0 eslint-plugin-promise@^4.2.1 || ^5.0.0
√ Would you like to install them now with npm? · Yes
Installing eslint-plugin-react@latest, eslint-config-standard@latest, eslint@^7.12.1, eslint-plugin-import@^2.22.1, eslint-plugin-node@^11.1.0, eslint-plugin-promise@^4.2.1 || ^5.0.0
npm WARN eslint_config@1.0.0 No description
npm WARN eslint_config@1.0.0 No repository field.

+ eslint-config-standard@16.0.3
+ eslint-plugin-promise@5.2.0
+ eslint-plugin-node@11.1.0
+ eslint-plugin-react@7.28.0
+ eslint-plugin-import@2.25.4
+ eslint@7.32.0
added 108 packages from 49 contributors, updated 18 packages and audited 196 packages in 23.462s

45 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


Oops! Something went wrong! :(

ESLint: 8.6.0

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/util/glob-util' is not defined by "exports" in S:\VS2017\Bootcamp\HOMEWORK\TUTORIALS\DELETE_React_NoBuild\eslint_config\node_modules\eslint\package.json
    at throwExportsNotFound (internal/modules/esm/resolve.js:285:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:508:3)
    at resolveExports (internal/modules/cjs/loader.js:450:36)
    at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (S:\VS2017\Bootcamp\HOMEWORK\TUTORIALS\DELETE_React_NoBuild\eslint_config\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at Object.<anonymous> (S:\VS2017\Bootcamp\HOMEWORK\TUTORIALS\DELETE_React_NoBuild\eslint_config\node_modules\eslint-plugin-import\lib\rules\no-unused-modules.js:40:7)
    at Module._compile (S:\VS2017\Bootcamp\HOMEWORK\TUTORIALS\DELETE_React_NoBuild\eslint_config\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
No code yet. Empty project.

What did you expect to happen?

Complete without error.

What actually happened?

Oops! Something went wrong! :(

ESLint: 8.6.0

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/util/glob-util' is not defined by "exports" in S:\VS2017\Bootcamp\HOMEWORK\TUTORIALS\DELETE_React_NoBuild\eslint_config\node_modules\eslint\package.json
    at throwExportsNotFound (internal/modules/esm/resolve.js:285:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:508:3)
    at resolveExports (internal/modules/cjs/loader.js:450:36)
    at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (S:\VS2017\Bootcamp\HOMEWORK\TUTORIALS\DELETE_React_NoBuild\eslint_config\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at Object.<anonymous> (S:\VS2017\Bootcamp\HOMEWORK\TUTORIALS\DELETE_React_NoBuild\eslint_config\node_modules\eslint-plugin-import\lib\rules\no-unused-modules.js:40:7)
    at Module._compile (S:\VS2017\Bootcamp\HOMEWORK\TUTORIALS\DELETE_React_NoBuild\eslint_config\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

I'm also confused by the ESLint: 8.6.0 in the on-screen message. The package.json shows a different eslint version:

{
  "name": "eslint_config",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "eslint": "^7.32.0",
    "eslint-config-standard": "^16.0.3",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^5.2.0",
    "eslint-plugin-react": "^7.28.0"
  }
}
@cek333 cek333 added bug ESLint is working incorrectly repro:needed labels Jan 12, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Jan 12, 2022
@aladdin-add
Copy link
Member

it should have been fixed in the @eslint/create-config. can you try npm init @eslint/config?

@cek333
Copy link
Author

cek333 commented Jan 12, 2022

Yes, that works. This time, during the setup, I'm prompted to downgrade eslint. Here's the full output:

$ npm init @eslint/config
npx: installed 40 in 13.681s
√ How would you like to use ESLint? · style
√ What type of modules does your project use? · esm
√ Which framework does your project use? · react
√ Does your project use TypeScript? · No
√ Where does your code run? · browser
√ How would you like to define a style for your project? · guide
√ Which style guide do you want to follow? · standard
√ What format do you want your config file to be in? · JavaScript
Checking peerDependencies of eslint-config-standard@latest
√ The style guide "standard" requires eslint@^7.12.1. You are currently using eslint@8.6.0.
  Do you want to downgrade? · Yes
The config that you've selected requires the following dependencies:

eslint-plugin-react@latest eslint-config-standard@latest eslint@^7.12.1 eslint-plugin-import@^2.22.1 eslint-plugin-node@^11.1.0 eslint-plugin-promise@^4.2.1 || ^5.0.0
√ Would you like to install them now with npm? · Yes
Installing eslint-plugin-react@latest, eslint-config-standard@latest, eslint@^7.12.1, eslint-plugin-import@^2.22.1, eslint-plugin-node@^11.1.0, eslint-plugin-promise@^4.2.1 || ^5.0.0
npm WARN eslint_config@1.0.0 No description
npm WARN eslint_config@1.0.0 No repository field.

+ eslint@7.32.0
+ eslint-plugin-promise@5.2.0
+ eslint-plugin-node@11.1.0
+ eslint-plugin-import@2.25.4
+ eslint-plugin-react@7.28.0
+ eslint-config-standard@16.0.3
added 108 packages from 49 contributors, updated 18 packages and audited 196 packages in 20.511s

45 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Successfully created .eslintrc.js file in S:\VS2017\Bootcamp\HOMEWORK\TUTORIALS\DELETE_React_NoBuild\eslint_config

Let me know if there is anything I can do to help resolve the discrepancy between npx eslint --init and npm init @eslint/config.

@cek333
Copy link
Author

cek333 commented Jan 12, 2022

Oh, I just saw the pull request #15150. It seems npm init @eslint/config is intended to be the new method of doing the setup. Is that correct?

@aladdin-add
Copy link
Member

yes, it's just merged but not released yet.

Triage automation moved this from Needs Triage to Complete Jan 12, 2022
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jul 12, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jul 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly repro:needed
Projects
Archived in project
Triage
Complete
Development

No branches or pull requests

2 participants