Skip to content

exec-child.js module not found, when running shell.exec() on Next.js Server Actions #1158

Description

@amruthpillai

Node version (or tell us if you're using electron or some other framework):

  • Node.js v20.12.2
  • Next.js v14.2.3

ShellJS version (the most recent version/Github branch you see the bug on):

  • ShellJS v0.8.5

Operating system:

  • macOS Sonoma 14.5

Description of the bug:

When running shelljs.exec() on a server action, this error gets thrown in the server console.

Error: Cannot find module '/.next/server/vendor-chunks/exec-child.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
    at Module._load (node:internal/modules/cjs/loader:984:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Example ShellJS command to reproduce the error:

import shell from "shelljs";

shell.exec("which docker");

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    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