Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: spawn /usr/bin/clamdscan --no-summary --fdpass --multiscan /usr/src/app/scandir ENOENT #76

Closed
mzaidse opened this issue Aug 5, 2021 · 1 comment
Labels
not a bug For bugs reported that are not specific to this module. question

Comments

@mzaidse
Copy link

mzaidse commented Aug 5, 2021

When running clamscan inside clamav docker container (Alpine based), it is giving error.

Steps to reproduce

  • Create Docker file
FROM clamav/clamav:unstable_base
WORKDIR /usr/src/app
COPY . .
RUN apk --no-cache add --virtual native-deps \
    bash g++ gcc libgcc libstdc++ linux-headers make \
    --update nodejs npm 
EXPOSE 3000
  • Create DockerCompose file
version: "3.2"
services:
  #=================================================================
  # ClamAV for Virus Scanning
  #=================================================================
  clamav:
    build: .
    container_name: clamav
    volumes:
      - clam-db:/var/lib/clamav
      - scandir:/usr/src/app/scandir
      - express-app:/usr/src/app
      - express-app\node_modules:/usr/src/app/node_modules
    ports: 
      - 3000:3000
  • NodeJs App
const NodeClam = require('clamscan');

async function startScan() {
  try {
      const clamscan = await new NodeClam().init();
      const {good_files, bad_files} = await clamscan.scan_dir(`${process.cwd()}/scandir`);
      console.log("🚀 ~ file: app.js ~ startScan ~ good_files", good_files)
      console.log("🚀 ~ file: app.js ~ startScan ~ bad_files", bad_files)
  } catch (err) {
      console.log("🚀 ~ file: app.js ~ startScan ~ err", err)
  }
}

startScan();

Error

Error: spawn /usr/bin/clamdscan --no-summary --fdpass --multiscan /usr/src/app/scandir ENOENT
    at parse_stdout (/usr/src/app/node_modules/clamscan/index.js:1221:87)
    at /usr/src/app/node_modules/clamscan/index.js:1239:37
    at exithandler (child_process.js:397:5)
    at ChildProcess.errorhandler (child_process.js:409:5)
    at ChildProcess.emit (events.js:400:28)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
    at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
(node:183) Error: Error: spawn /usr/bin/clamdscan --no-summary --fdpass --multiscan /usr/src/app/scandir ENOENT
    at parse_stdout (/usr/src/app/node_modules/clamscan/index.js:1221:87)
    at /usr/src/app/node_modules/clamscan/index.js:1239:37
    at exithandler (child_process.js:397:5)
    at ChildProcess.errorhandler (child_process.js:409:5)
    at ChildProcess.emit (events.js:400:28)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
(node:183) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    at emitDeprecationWarning (internal/process/promises.js:180:11)
    at processPromiseRejections (internal/process/promises.js:249:13)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
@kylefarris
Copy link
Owner

Try running which clamdscan on your terminal to see what the path to the executable is. If it's not /usr/bin/clamdscan, then you need to specify the correct path when you initialize.

const clamscan = await new NodeClam().init({
    clamdscan: {
        path: `/your/clamdscan/path`
    }
});

The full list of config options can be found here: https://github.com/kylefarris/clamscan#getting-started

@kylefarris kylefarris added not a bug For bugs reported that are not specific to this module. question labels Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug For bugs reported that are not specific to this module. question
Projects
None yet
Development

No branches or pull requests

2 participants