nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.52k stars 2.35k forks source link

wrong OS version reported/recognised mac M1 Error: Failed to load plugin '@nx' declared in 'apps/web-app/.eslintrc.json': Cannot find module '@nx/nx-darwin-arm64' #22406

Closed AliceMenzie closed 7 months ago

AliceMenzie commented 7 months ago

Current Behavior

Generating new workspace results in wrong OS version in Mac M1 results in nx report OS : darwin-x64. ESLint error Error: Failed to load plugin '@nx' declared in 'apps/web-app/.eslintrc.json': Cannot find module '@nx/nx-darwin-arm64'

Screenshot 2024-03-20 at 11 31 59 AM Screenshot 2024-03-20 at 11 35 14 AM

Expected Behavior

OS: darwin-arm-64 + eslint then show linting errors in IDE

GitHub Repo

https://github.com/AliceMenzie/nx-issue

Steps to Reproduce

  1. npx create-nx-workspace@latest --preset=next

    Screenshot 2024-03-20 at 11 34 00 AM
  2. nx report or pnpm nx report


 NX   Report complete - copy this into the issue template

Node   : 20.11.1
OS     : darwin-x64
pnpm   : 8.7.4

nx (global)        : 18.1.2
nx                 : 18.1.2
@nx/js             : 18.1.2
@nx/jest           : 18.1.2
@nx/eslint         : 18.1.2
@nx/workspace      : 18.1.2
@nx/eslint-plugin  : 18.1.2
@nx/next           : 18.1.2
typescript         : 5.3.3```

3. ``` nx run web-app:lint``` 
runs successfully with error , open file where error is and go to output in terminal (eslint)
<img width="1032" alt="Screenshot 2024-03-20 at 11 44 02 AM" src="https://github.com/nrwl/nx/assets/73300606/197971c0-c003-4149-af
<img width="1068" alt="Screenshot 2024-03-20 at 11 44 38 AM" src="https://github.com/nrwl/nx/assets/73300606/b384499f-24cb-41ec-a74d-517ac8a05af6">
4a-1272336d1ed9">
error: ```Error: Failed to load plugin '@nx' declared in 'apps/web-app/.eslintrc.json': Cannot find module '@nx/nx-darwin-arm64'```  and  not showing in ide 
<img width="833" alt="Screenshot 2024-03-20 at 11 45 30 AM" src="https://github.com/nrwl/nx/assets/73300606/7933ab54-f572-41b3-b369-1fd5d376eae9">

### Nx Report

```shell
NX   Report complete - copy this into the issue template

Node   : 20.11.1
OS     : darwin-x64
pnpm   : 8.7.4

nx (global)        : 18.1.2
nx                 : 18.1.2
@nx/js             : 18.1.2
@nx/jest           : 18.1.2
@nx/eslint         : 18.1.2
@nx/workspace      : 18.1.2
@nx/eslint-plugin  : 18.1.2
@nx/next           : 18.1.2
typescript         : 5.3.3

❯ pnpm nx report

 NX   Report complete - copy this into the issue template

Node   : 20.11.1
OS     : darwin-x64
pnpm   : 8.7.4

nx                 : 18.1.2
@nx/js             : 18.1.2
@nx/jest           : 18.1.2
@nx/linter         : 18.1.2
@nx/eslint         : 18.1.2
@nx/workspace      : 18.1.2
@nx/devkit         : 18.1.2
@nx/eslint-plugin  : 18.1.2
@nx/next           : 18.1.2
@nx/react          : 18.1.2
@nrwl/tao          : 18.1.2
@nx/web            : 18.1.2
@nx/webpack        : 18.1.2
typescript         : 5.3.3

Failure Logs

[Info  - 11:17:33] ESLint server is starting.
[Info  - 11:17:33] ESLint server running in node v18.17.1
[Info  - 11:17:33] ESLint server is running.
[Info  - 11:17:34] ESLint library loaded from: /Users/alice/Desktop/test-org/node_modules/.pnpm/eslint@8.48.0/node_modules/eslint/lib/api.js
[Error - 11:17:34] Calculating config file for file:///Users/alice/Desktop/test-org/apps/web-app/src/app/page.tsx) failed.
Error: Failed to load plugin '@nx' declared in 'apps/web-app/.eslintrc.json': Cannot find module '@nx/nx-darwin-arm64'
Require stack:
- /Users/alice/Desktop/test-org/node_modules/.pnpm/nx@18.1.2_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/native/index.js
- /Users/alice/Desktop/test-org/node_modules/.pnpm/nx@18.1.2_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/tasks-runner/pseudo-terminal.js
- /Users/alice/Desktop/test-org/node_modules/.pnpm/nx@18.1.2_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/command-line/run/run.js
- /Users/alice/Desktop/test-org/node_modules/.pnpm/nx@18.1.2_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/devkit-exports.js
- /Users/alice/Desktop/test-org/node_modules/.pnpm/@nx+devkit@18.1.2_nx@18.1.2/node_modules/@nx/devkit/index.js
- /Users/alice/Desktop/test-org/node_modules/.pnpm/@nx+eslint-plugin@18.1.2_@swc-node+register@1.8.0_@swc+core@1.3.107_@types+node@18.16.9_@type_yerqoovuhhr6dxhcm3qc4nttiu/node_modules/@nx/eslint-plugin/src/configs/typescript.js
- /Users/alice/Desktop/test-org/node_modules/.pnpm/@nx+eslint-plugin@18.1.2_@swc-node+register@1.8.0_@swc+core@1.3.107_@types+node@18.16.9_@type_yerqoovuhhr6dxhcm3qc4nttiu/node_modules/@nx/eslint-plugin/src/index.js
- /Users/alice/Desktop/test-org/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
Referenced from: /Users/alice/Desktop/test-org/apps/web-app/.eslintrc.json
    at Function._resolveFilename (node:internal/modules/cjs/loader:1084:15)
    at node:internal/modules/cjs/loader:929:27
    at Function._load (node:electron/js2c/node_init:2:13357)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/Users/alice/Desktop/test-org/node_modules/.pnpm/nx@18.1.2_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/native/index.js:135:29)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12

Package Manager Version

pnpm 8.7.4

Operating System

Additional Information

node -v v20.11.1

FrozenPandaz commented 7 months ago

It was an update to homebrew which caused the issue.

We just updated our troubleshooting page to have more information about it.

https://nx.dev/recipes/troubleshooting/troubleshoot-nx-install-issues#nodejs-installation-issues

Try reinstalling Homebrew, Node, and VS Code and see if the issue is resolved. It's quite a process but the issue is not within Nx.

github-actions[bot] commented 6 months ago

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.