nx: Cannot find module '@nrwl/linter/package.json' when running lint

Current Behavior

An error is shown when running lint command

 Cannot find module '@nrwl/linter/package.json'
   Require stack:
   - <path>\node_modules\nx\src\utils\package-json.js
   - <path>\node_modules\nx\src\utils\package-manager.js
   - <path>\node_modules\nx\bin\init-local.js
   - <path>\node_modules\nx\bin\nx.js
   Pass --verbose to see the stacktrace.

Expected Behavior

No error

GitHub Repo

No response

Steps to Reproduce

  1. upgraded from 16.6.0 to 17.0.3
  2. run nx affected -t lint

Nx Report

Node   : 18.16.0
   OS     : win32-x64
   yarn   : 1.22.19

   nx                 : 17.0.3
   @nx/js             : 17.0.3
   @nx/jest           : 17.0.3
   @nx/linter         : 17.0.3
   @nx/eslint         : 17.0.3
   @nx/workspace      : 17.0.3
   @nx/angular        : 17.0.3
   @nx/cypress        : 17.0.3
   @nx/devkit         : 17.0.3
   @nx/eslint-plugin  : 17.0.3
   @nx/node           : 17.0.3
   @nx/plugin         : 17.0.3
   @nx/storybook      : 17.0.3
   @nrwl/tao          : 17.0.3
   @nx/web            : 17.0.3
   @nx/webpack        : 17.0.3
   typescript         : 5.1.6
   ---------------------------------------
   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.2.1
   ---------------------------------------

Failure Logs

Cannot find module '@nrwl/linter/package.json'
   Require stack:
   - <path>\node_modules\nx\src\utils\package-json.js
   - <path>\node_modules\nx\src\utils\package-manager.js
   - <path>\node_modules\nx\bin\init-local.js
   - <path>\node_modules\nx\bin\nx.js
   Pass --verbose to see the stacktrace.


### Package Manager Version

_No response_

### Operating System

- [ ] macOS
- [ ] Linux
- [X] Windows
- [ ] Other (Please specify)

### Additional Information

_No response_

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 6
  • Comments: 18 (6 by maintainers)

Most upvoted comments

We are getting the same thing.

@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.

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.