Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Depcheck started returning incorrect unused dependencies without any changes #687

@tm-slavik57

Description

@tm-slavik57

Bug Description

I'm not sure it's related, but since of today depcheck started reporting incorrect unused dependencies.

Versions

  • node -v: 14.16.1
  • npm -v: 6.14.12
  • depcheck --version: 1.4.2

Extra info

We are using npx depcheck and until yesterday it worked in our CI, starting from today it stopped working.
We didn't change anything, and on the same commit, it worked yesterday it stopped working today.

I tried to figure out what's wrong so I ran the depcheck locally on my laptop and it worked.
I then looked at the depcheck installed globally on my laptop and saw it's from July.
At this point the depcheck version is 1.4.2

Running npx depcheck resulted in this output:

$ npx depcheck --config=./ci/.depcheckrc
No depcheck issue

After that I reinstalled it globally using:

$ npm install -g depcheck
C:\Users\Slavas\AppData\Roaming\npm\depcheck -> C:\Users\Slavas\AppData\Roaming\npm\node_modules\depcheck\bin\depcheck.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\depcheck\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

The depcheck version didn't change and remained 1.4.2

Now running the check command fails:

$ npx depcheck --config=./ci/.depcheckrc
Unused dependencies
* aws-sdk
* express
Unused devDependencies
* @types/chai
* @types/kafkajs
* chai
* chai-as-promised
* http-status-codes
* kafkajs

My assumption is when running npx is that it used the cached version that was on my laptop and after reinstalling it, it downloaded a new version and stopped working.

The thing I don't understand is that depcheck -v returned 1.4.2 both while the behaviour changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions