question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to load plugin '@nrwl/nx' declared in 'apps/project/.eslintrc.json » ../../../.eslintrc.js#overrides[1]': Cannot find module '@swc/core-linux-x64-gnu'

See original GitHub issue

Current Behavior

Since the upgrade the Nrwl 13+, when I run the affected lint target on the CI (azure devops), I got this error on all projects:

Failed to load plugin '@nrwl/nx' declared in 'apps/shared-ui-e2e/.eslintrc.json » ../../../.eslintrc.js#overrides[1]': Cannot find module '@swc/core-linux-x64-gnu'
Require stack:
- /var/vsts/temporary-agent-grizzly-l4j54/1/s/node_modules/@swc/core/binding.js
- /var/vsts/temporary-agent-grizzly-l4j54/1/s/node_modules/@swc/core/index.js
- /var/vsts/temporary-agent-grizzly-l4j54/1/s/node_modules/@swc-node/core/lib/index.js
- /var/vsts/temporary-agent-grizzly-l4j54/1/s/node_modules/@swc-node/register/lib/register.js
- /var/vsts/temporary-agent-grizzly-l4j54/1/s/node_modules/@nrwl/eslint-plugin-nx/src/resolve-workspace-rules.js
- /var/vsts/temporary-agent-grizzly-l4j54/1/s/node_modules/@nrwl/eslint-plugin-nx/src/index.js
- /var/vsts/temporary-agent-grizzly-l4j54/1/s/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
Referenced from: /var/vsts/temporary-agent-grizzly-l4j54/1/s/.eslintrc.js

I already put a comment on this closed issue: #8735. @meeroslav also made a PR #8831 that should fix the issue on 13.7.3 but I am still having it.

For the moment I have to install the library each time I run a lint command on the CI:

 yarn add @swc/core-linux-x64-gnu --dev

But this is increasing a lot of the time to the CI process

Expected Behavior

To not have this error

Steps to Reproduce

yarn affected:lint

Environment

   Node : 16.13.1
   OS   : darwin x64
   yarn : 1.22.17

   nx : 13.8.1
   @nrwl/angular : 13.8.1
   @nrwl/cli : 13.8.1
   @nrwl/cypress : 13.8.1
   @nrwl/detox : undefined
   @nrwl/devkit : 13.8.1
   @nrwl/eslint-plugin-nx : 13.8.1
   @nrwl/express : undefined
   @nrwl/jest : 13.8.1
   @nrwl/js : 13.8.1
   @nrwl/linter : 13.8.1
   @nrwl/nest : undefined
   @nrwl/next : undefined
   @nrwl/node : 13.8.1
   @nrwl/nx-cloud : undefined
   @nrwl/react : undefined
   @nrwl/react-native : undefined
   @nrwl/schematics : undefined
   @nrwl/storybook : 13.8.1
   @nrwl/tao : 13.8.1
   @nrwl/web : 13.8.1
   @nrwl/workspace : 13.8.1
   typescript : 4.5.5
   rxjs : 7.5.4
   ---------------------------------------
   Community plugins:
   	 @angular/animations: 13.2.2
   	 @angular/cdk: 13.2.2
   	 @angular/common: 13.2.2
   	 @angular/compiler: 13.2.2
   	 @angular/core: 13.2.2
   	 @angular/forms: 13.2.2
   	 @angular/material: 13.2.2
   	 @angular/platform-browser: 13.2.2
   	 @angular/platform-browser-dynamic: 13.2.2
   	 @angular/router: 13.2.2
   	 @auth0/auth0-angular: 1.7.0
   	 @ngneat/edit-in-place: 1.6.1
   	 @ngneat/transloco: 3.1.3
   	 @ngrx/component: 13.0.2
   	 @ngrx/component-store: 13.0.2
   	 ng2-charts: 3.0.8
   	 single-spa-angular: 6.0.1
   	 @angular-builders/custom-webpack: 13.1.0
   	 @angular-devkit/architect: 0.1302.3
   	 @angular-devkit/build-angular: 13.2.3
   	 @angular/cli: 13.2.3
   	 @angular/compiler-cli: 13.2.2
   	 @angular/language-service: 13.2.2
   	 @compodoc/compodoc: 1.1.18
   	 @ngneat/spectator: 10.0.0
   	 @storybook/angular: 6.4.19
   	 @twittwer/compodoc: 1.6.6

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:29 (14 by maintainers)

github_iconTop GitHub Comments

4reactions
bubblegumsoldiercommented, Feb 15, 2022

Hi, I am having the same issue, but not with yarn but with npm. I have checked the package-lock.json where I find the “@swc/core-linux-x64-gnu” as an “optionalDependency” in “node_modules/@swc/core” and “node_modules/@nrwl/eslint-plugin-nx” and and as “requires” in “@nrwl/eslint-plugin-nx” and “@swc/core”. I am using the npm ci command which takes care of not caching the node_modules folder. Thus neither one could really be the problem. Any ideas or recommendations?

2reactions
meeroslavcommented, Mar 29, 2022

@JosefBredereck I have just checked the windows and everything works as expected. If you have an issue, please follow the following steps:

  • Remove lock file & node_modules (e.g. rm -rf node_modules package-lock.json yarn.lock pnpm-lock.yaml)
  • Clear the cache (npm cache clean or yarn cache clean)
  • Re-install dependencies (e.g. npm i or yarn or pnpm)

That should ensure your lock file has properly picked up missing @swc/core-... packages.

The same solution applies also to @bubblegumsoldier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to load plugin 'import' declared in '... » eslint-config ...
ESLint : 8.9.0 Error: Failed to load plugin 'import' declared in '.eslintrc.js': Cannot find module 'es-abstract/2021/RequireObjectCoercible' ...
Read more >
Using ESLint in Nx Workspaces
ESLint is powerful linter by itself, able to work on the syntax of your source files and assert things about based on the...
Read more >
Failed to load plugin '@nrwl/nx': Cannot find module '@swc ...
I'm having an issue running my linting tasks on my CI server. The error message that comes up is that the module can't...
Read more >
ESLint: TypeError: Error while loading rule '@nrwl/nx/enforce ...
ts (Typescript) file in a project on Angular 11 I get an ESLint error. TypeError: Error while loading rule '@nrwl/nx/enforce-module-boundaries': Cannot read ...
Read more >
@nrwl/eslint-plugin-nx - npm
The create-nx-workspace command will ask you to select a preset, which will configure some plugins and create your applications to help you get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found