Skip to content

Nx should clear the cache after a migration #27295

@PowerSupply

Description

@PowerSupply

Current Behavior

Here is a description of the problem that pointed me to the conclusion in the title:

After upgrading to 19.5 from 19.0.4 the dependency-check lint rule started to fail with false negatives.

It said:
error The "@nx/devkit" package is not used by "xxx" project

But it is used! And the lint worked before the upgrade to 19.5. Running the command with --skip-nx-cache still fails. But what is weird is that going to the file where @nx/devkit is imported and just making a small inconsequential change to it (like moving the line with the import to being second instead of first) makes the error go away. And then it doesn't appear again.

Runningnx reset and then trying the command again seems to fix it which points to some sort of local cache error. I think Nx should reset itself when migrating to a new version since it seems like the cache becomes dirty. But I do not understand why the error still appeared when i used --skip-nx-cache.

Expected Behavior

The problem I had should not have appeared. Proposed solution is to run nx reset as a part of migration to a new version of nx.

GitHub Repo

No response

Steps to Reproduce

  1. Use Nx 19.0.4. Have a project that passes lint.
  2. Upgrade to Nx 19.5.
  3. Try to run the lint for the same project. It may fail even if it should succeed and making a small inconsequential change to the file where the import is fixes the problem. Nx reset also fixes the problem.

Nx Report

Node           : 18.15.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 9.5.0

nx                 : 19.5.6
@nx/js             : 19.5.6
@nx/jest           : 19.5.6
@nx/linter         : 19.5.6
@nx/eslint         : 19.5.6
@nx/workspace      : 19.5.6
@nx/angular        : 19.5.6
@nx/cypress        : 19.5.6
@nx/devkit         : 19.5.6
@nx/eslint-plugin  : 19.5.6
@nx/playwright     : 19.5.6
@nx/plugin         : 19.5.6
@nrwl/tao          : 19.5.6
@nx/vite           : 19.5.6
@nx/web            : 19.5.6
@nx/webpack        : 19.5.6
typescript         : 5.4.5

Failure Logs

error  The "@nx/devkit" package is not used by "xxx" project

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions