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.

Different output when invoking from shell script #617

@stefanos1316

Description

@stefanos1316

Bug Description

When executing the depcheck from the command-line it works I get the expected output.
However, when trying to store depcheck's result in a Bash or Shell variable I get a different output.

Code snippets

Here is the code snippet

#!/bin/bash

result=$(npx depcheck)
echo $result

and here is the output

Unused dependencies install_and_configure.yaml LICENSE logs monolithic_server.js node_modules package.json package-lock.json README.md routes test test.sh utils util.sh axios install_and_configure.yaml LICENSE logs monolithic_server.js node_modules package.json package-lock.json README.md routes test test.sh utils util.sh depcheck install_and_configure.yaml LICENSE logs monolithic_server.js node_modules package.json package-lock.json README.md routes test test.sh utils util.sh request

It outputs as unused dependencies all the files of my project, but when running in the command line I get the following:

$ npx depcheck
Unused dependencies
* axios
* depcheck
* request

Where the dependency is listed in package.json:

  "dependencies": {
    "axios": "^0.21.0",
    "chai": "^4.2.0",
    "depcheck": "^1.3.1",
    "email-validator": "^2.0.4",
    "exec-sh": "^0.3.4",
    "express": "^4.17.1",
    "express-fileupload": "^1.2.0",
    "image-type": "^4.1.0",
    "imagemin": "^7.0.1",
    "imagemin-jpegtran": "^7.0.0",
    "imagemin-pngquant": "^9.0.1",
    "mocha": "^8.2.1",
    "request": "^2.88.2",
    "superagent": "^6.1.0",
    "tmp": "^0.2.1",
    "winston": "^3.3.3"
  },
  "devDependencies": {
    "mongodb": "^3.6.3",
    "nodemon": "^2.0.6"
  }

Versions

  • node -v: 14.15.1
  • npm -v: 6.14.8
  • depcheck --version: 1.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions