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 [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './config' is not defined by "exports" #160

Closed
1 task
flpmswap opened this issue Mar 27, 2025 · 1 comment · Fixed by #161
Closed
1 task
Assignees
Labels
accepted bug Something isn't working

Comments

@flpmswap
Copy link

Environment

Node version: v20.19/v22.14
npm version: 10.8.2/10.9.2
Local ESLint version: v8.57.1
Global ESLint version: Not Found
Operating System: linux 6.8.0-1021-azure and linux 5.15.167.4-microsoft-standard-WSL2

What parser are you using?

Other

What did you do?

Configuration
npm init
npm init @eslint/config@latest
# use `eslint-config-standard` shared config - npm 7+
npm init @eslint/config@latest -- --config eslint-config-standard
npx eslint ./index.js
# use `eslint-config-standard` shared config - npm 7+
npm init @eslint/config@latest -- --config eslint-config-standard

create an index.js in the root folder

export function test() {
    console.log('test')
}

also in the devDependencies in package.json, I´ve the followind dependencies

{
"devDependencies": {
    "@eslint/js": "^9.23.0",
    "eslint": "^8.57.1",
    "eslint-config-standard": "^17.1.0",
    "eslint-plugin-import": "^2.31.0",
    "eslint-plugin-n": "^16.6.2",
    "eslint-plugin-promise": "^6.6.0",
    "globals": "^16.0.0",
    "husky": "^9.1.7",
    "jest": "^29.7.0",
    "prettier": "^3.5.3"
  }
}

What did you expect to happen?

run eslint without errors for JS

What actually happened?

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './config' is not defined by "exports" in /workspaces/repro-eslint-codespace/node_modules/eslint/package.json imported from /workspaces/repro-eslint-codespace/eslint.config.js
    at exportsNotFound (node:internal/modules/esm/resolve:322:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:670:9)
    at packageResolve (node:internal/modules/esm/resolve:856:14)
    at moduleResolve (node:internal/modules/esm/resolve:946:18)
    at defaultResolve (node:internal/modules/esm/resolve:1188:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:642:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:591:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:574:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:236:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:130:49)

Link to Minimal Reproducible Example

https://github.com/flpmswap/repro-eslint-codespace

Participation

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

Additional comments

No response

@flpmswap flpmswap added bug Something isn't working repro:needed labels Mar 27, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Mar 27, 2025
@snitin315
Copy link
Contributor

@flpmswap Thanks for the report. I can confirm that this is a valid bug & I'm able to reproduce.

This issue seems to be introduced via #156

The issue is that defineConfig was exported recently in v9.22, but the project generated is using v8

I'll work on it, moving this to eslint/create-config.

@snitin315 snitin315 moved this from Needs Triage to Ready to Implement in Triage Mar 28, 2025
@snitin315 snitin315 transferred this issue from eslint/eslint Mar 28, 2025
@snitin315 snitin315 self-assigned this Mar 28, 2025
@github-project-automation github-project-automation bot moved this from Ready to Implement to Complete in Triage Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working
Projects
Status: Complete
Development

Successfully merging a pull request may close this issue.

2 participants