nx
nx copied to clipboard
[Mac]: Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
Current Behavior
I'm getting an error for every Nx command. Even a simple nx run myApp:test fails.
Running with Verbose gives me the following error:
Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
An error occurred while processing files for the @nx/eslint/plugin plugin.
- apps/myProject/eslint.config.js: Config (unnamed): Key "plugins": Cannot redefine plugin "@typescript-eslint".
ConfigError: Config (unnamed): Key "plugins": Cannot redefine plugin "@typescript-eslint".
at rethrowConfigError (/Users/mainUser/Projects/personal-projects/myProject/node_modules/.pnpm/@[email protected]/node_modules/@eslint/config-array/dist/cjs/index.cjs:303:8)
at /Users/mainUser/Projects/personal-projects/myProject/node_modules/.pnpm/@[email protected]/node_modules/@eslint/config-array/dist/cjs/index.cjs:1098:5
at Array.reduce (<anonymous>)
at FlatConfigArray.getConfigWithStatus (/Users/mainUser/Projects/personal-projects/myProject/node_modules/.pnpm/@[email protected]/node_modules/@eslint/config-array/dist/cjs/index.cjs:1091:43)
at FlatConfigArray.getConfig (/Users/mainUser/Projects/personal-projects/myProject/node_modules/.pnpm/@[email protected]/node_modules/@eslint/config-array/dist/cjs/index.cjs:1120:15)
at ESLint.calculateConfigForFile (/Users/mainUser/Projects/personal-projects/myProject/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint.js:1187:24)
at async ESLint.isPathIgnored (/Users/mainUser/Projects/personal-projects/myProject/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint.js:1209:24)
at async /Users/mainUser/Projects/personal-projects/myProject/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nx/eslint/src/plugins/plugin.js:123:19
at async Promise.all (index 0)
at async internalCreateNodesV2 (/Users/mainUser/Projects/personal-projects/myProject/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nx/eslint/src/plugins/plugin.js:106:5)
Expected Behavior
I expect it to run the tests
GitHub Repo
No response
Steps to Reproduce
- Installed a new nuxt project with multiple apps setup
- Added a new API file
- Added a new test file for the API file
- Tried to run the test
- Got the error
Nx Report
Node : 20.3.0 OS : darwin-x64 Native Target : x86_64-macos pnpm : 8.6.12
nx (global) : 20.0.0 nx : 20.0.0 @nx/js : 20.0.0 @nx/jest : 20.0.0 @nx/eslint : 20.0.0 @nx/workspace : 20.0.0 @nx/devkit : 20.0.0 @nx/esbuild : 20.0.0 @nx/eslint-plugin : 20.0.0 @nx/node : 20.0.0 @nx/nuxt : 20.0.0 @nx/playwright : 20.0.0 @nx/vite : 20.0.0 @nx/web : 20.0.0 typescript : 5.5.2
Registered Plugins: @nx/eslint/plugin @nx/jest/plugin @nx/vite/plugin @nx/nuxt/plugin @nx/playwright/plugin
Failure Logs
No response
Package Manager Version
No response
Operating System
- [x] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
No response
What does your ESLint config look like? Do you have the @typescript-eslint plugin declared more than once like the error shows?
I experience this issue as well because I have another dependency that references the typescript-eslint plugin. This looks like an issue with the new flat configuration style as noted here: https://github.com/eslint/eslintrc/issues/135
I'm not sure there's much NX can do until there's some kind of registry paradigm for eslint plugins.
It's a brand new Nx project. Changed nothing. My config looks like this:
const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const baseConfig = require('../../eslint.config.js');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
module.exports = [
...baseConfig,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'],
// Override or add rules here
rules: {},
},
...compat.extends('@nuxt/eslint-config'),
{
files: ['**/*.vue'],
languageOptions: {
parserOptions: { parser: require('@typescript-eslint/parser') },
},
},
{ ignores: ['.nuxt/**', '.output/**', 'node_modules'] },
];
Even if I delete
languageOptions: {
parserOptions: { parser: require('@typescript-eslint/parser') },
},
Which is the only mention of eslint in the project, I get the error because it stems from @nx/eslint/plugin which I have no control over.
Any way to bypass this without turning off linting?
@jaysoo @drwpow
This happens for me with a fresh nuxt app install. I did nothing - just installed a new Nx project and ran pnpm start.
Is there any workaround?
+1 for this, as it is also happening on next plugins.
Create the app:
Lint it:
Got the same for a new next application on Nx 20.2.2.
I identified the problem to fixupConfigRules which seems to mess things up.
Our workspace uses flat eslint. Changed to this just to get it working.
const nx = require('@nx/eslint-plugin');
const baseConfig = require('../../eslint.config.js');
module.exports = [
...baseConfig,
...nx.configs['flat/react-typescript'],
{
ignores: ['.next/**/*']
}
];
I usually rename app config
jsfiles tocjssince our workspace use moduleesnext.
Nx daemon is also happy with FlatCompat but linting breaks since the purpose of fixupConfigRules isn't applied.
const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const nx = require('@nx/eslint-plugin');
const baseConfig = require('../../eslint.config.js');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended
});
module.exports = [
...baseConfig,
...nx.configs['flat/react-typescript'],
...compat.config({
extends: ['next', 'next/core-web-vitals']
}),
{
ignores: ['.next/**/*']
}
];