Closed aikrez closed 11 months ago
We are getting the same thing.
What does the project.json
file look like for the project that is erroring?
I do not see on which project the command is giving an errror
npx nx affected -t lint --verbose
(we still have a workspace.json but that is for a custom script that needs to be refactored)
Nx no longer reads configuration from workspace.json.
Run "nx g @nx/workspace:fix-configuration" to split workspace.json into individual project.json files.
> NX Affected criteria defaulted to --base=master --head=HEAD
> NX Unable to resolve @nrwl/linter:eslint.
Cannot find module '@nrwl/linter/package.json'
Require stack:
- <repo_path>\node_modules\nx\src\utils\package-json.js
- <repo_path>\node_modules\nx\src\utils\package-manager.js
- <repo_path>\node_modules\nx\bin\init-local.js
- <repo_path>\node_modules\nx\bin\nx.js
Error: Unable to resolve @nrwl/linter:eslint.
Cannot find module '@nrwl/linter/package.json'
Require stack:
- <repo_path>\node_modules\nx\src\utils\package-json.js
- <repo_path>\node_modules\nx\src\utils\package-manager.js
- <repo_path>\node_modules\nx\bin\init-local.js
- <repo_path>\node_modules\nx\bin\nx.js
at getExecutorInformation (<repo_path>\node_modules\nx\src\command-line\run\executor-utils.js:53:15)
at getExecutorForTask (<repo_path>\node_modules\nx\src\tasks-runner\utils.js:187:56)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async getCustomHasher (<repo_path>\node_modules\nx\src\tasks-runner\utils.js:191:22)
at async <repo_path>\node_modules\nx\src\hasher\hash-task.js:11:30
at async Promise.all (index 43)
at async hashTasksThatDoNotDependOnOutputsOfOtherTasks (<repo_path>\node_modules\nx\src\hasher\hash-task.js:10:30)
at async invokeTasksRunner (<repo_path>\node_modules\nx\src\tasks-runner\run-command.js:136:5)
at async <repo_path>\node_modules\nx\src\tasks-runner\run-command.js:91:24
at async handleErrors (<repo_path>\node_modules\nx\src\utils\params.js:9:16)```
The only thing that is changed in the project.json
![image](https://github.com/nrwl/nx/assets/8655340/afb58385-fb64-4f8b-a0f2-3ddae83fd1e5)
Same with us migration largely did the above to all the project files. This is the output from CI:
> NX Unable to resolve @nrwl/linter:eslint.
Cannot find module '@nrwl/linter/package.json'
Require stack:
- /runner/_work/frontend/frontend/node_modules/nx/src/utils/package-json.js
- /runner/_work/frontend/frontend/node_modules/nx/src/utils/package-manager.js
- /runner/_work/frontend/frontend/node_modules/nx/bin/init-local.js
- /runner/_work/frontend/frontend/node_modules/nx/bin/nx.js
Pass --verbose to see the stacktrace.
I'm also experiencing the same issue, locally the Linting works just fine but in CI it fails to load the resolve
NX Failed to load plugin '@nx' declared in 'packages/jobs/.eslintrc.json » ../../.eslintrc.json#overrides[1]': Unexpected identifier
I'm running into the same issue. Thanks for the screenshot, @aikrez – I checked and apparently the executor
was switched for projects in the apps
folder but not for the ones in the libs
folder.
For my apps
, I also have "executor": "@nrwl/linter:eslint",
for the lint
target. For the libs
folder, each project has "executor": "@nx/eslint:lint",
– changing the former to @nx/eslint:lint
executor fixes it.
Question is where this is coming from 😅
updated to 17.1.1 and still the same error
> NX Report complete - copy this into the issue template
Node : 18.16.0
OS : win32-x64
yarn : 1.22.19
nx : 17.1.1
@nx/js : 17.1.1
@nx/jest : 17.1.1
@nx/linter : 17.1.1
@nx/eslint : 17.1.1
@nx/workspace : 17.1.1
@nx/angular : 17.1.1
@nx/cypress : 17.1.1
@nx/devkit : 17.1.1
@nx/eslint-plugin : 17.1.1
@nx/node : 17.1.1
@nx/plugin : 17.1.1
@nx/storybook : 17.1.1
@nrwl/tao : 17.1.1
@nx/web : 17.1.1
@nx/webpack : 17.1.1
typescript : 5.2.2
---------------------------------------
Community plugins:
@compodoc/compodoc : 1.1.21
@ng-bootstrap/ng-bootstrap : 14.1.1
@ngrx/component-store : 16.1.0
@ngrx/effects : 16.1.0
@ngrx/router-store : 16.1.0
@ngrx/schematics : 16.1.0
@ngrx/store : 16.1.0
@ngrx/store-devtools : 16.1.0
@storybook/angular : 7.5.3
---------------------------------------
Local workspace plugins:
@fe-parts/workspace-plugin
I managed to get around it by adding "@nrwl/linter": "^17.1.1"
manually to the package.json.
I suppose this should be added by the migration script?
I am getting this issue after migrating to (or rather in the process of migrating to) nx 17.1.2. The linting works if you select a single project. All of the project configurations were updated (via the migration scripts) and the @nrwl/linter
does not appear in my code or project files.
The problem arises when I use nx run-many
or nx affected
and attempt to lint. It appears that some configuration that I don't control is referencing the old linter.
Using the suggestion in the previous comment to manually install @nrwl/linter
works around the errors that I am getting using run-many
and affected
.
Hi all,
If you were migrating from the 16.x
version to the 17.x
you shouldn't have @nrwl/linter
in the first place. The migrations in the v17 version provide a migration path from @nx/linter
(introduced in v16) to
@nx/eslint`.
I'm surprised you still had @nrwl/*
packages in v16
repo.
Can someone provide a test repo or a path to reproduce this (without manually messing up the package.json
)?
If you need quick fix, just replace all your @nrwl/linter:eslint
target executors with @nx/eslint:lint
(again this should have been resolved by the migration).
@HerrBertling can you paste here the config for one of your apps and libs (ideally before the migration to v17) to see what is different about them that made it break the migration.
@aikrez don't install @nrwl/linter
. That package is outdated and will be eventually gone in v18.
Fix your executors. Your codebase should not have any reference to @nrwl/*
packages.
@aikrez don't install
@nrwl/linter
. That package is outdated and will be eventually gone in v18. Fix your executors. Your codebase should not have any reference to@nrwl/*
packages.
I removed it and indeed 5 of the 180 libs did not migrate correctly where I had to change the lint and jest package.
Had the following @nrwl leftovers:
@aikrez can you check got history if this happened during the v16 migration or someone added those later?
Those packages were not added to the package.json (except linter which I added manually). It were remaining executors that used the nrwl packages.
Had the same problem and manually searched for @nrwl
in my codebase. For any reason, one project (out of 134) was not running through the migrations. I adjusted it manually, replaced the builders as @meeroslav said, and I could uninstall @nrwl/linter
again. Thanks!
@meeroslav It just dawned on me that this might be due to the apps
being Remix apps. Maybe they were scaffolded with @nrwl/linter
still used in the @nx/remix
package? 🤔
I cannot really trace back that traced it back, the apps were scaffolded with "@nx/remix": "^16.8.2",
. While I of course found the @nx/remix
NPM package, there is no link to a repository that I could check. Also, that @nx/remix
package seems to have been updated a month ago to v17
. Our scaffolding happened before that. And that package and its apps are probably not part of the normal nx migrate
paths.
My best guess is that the @nrwl/linter
usages were a leftover from that package scaffolding the two apps we have. The necessary changes then simply were not picked up in the correct places. If you happen to know the location of the @nx/remix
package, maybe look there?
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
An error is shown when running lint command
Expected Behavior
No error
GitHub Repo
No response
Steps to Reproduce
Nx Report
Failure Logs