Skip to content

[BUG] tsed-prisma bin published without shebang since 8.35.0 — prisma generate fails with shell syntax errors #3418

Description

@Tomdrouv1

Describe the bug

Since v8.35.0, the tsed-prisma generator binary is published without a shebang line, so prisma generate fails with shell syntax errors.

package.json maps the bin to an ESM file:

"bin": {
  "tsed-prisma": "lib/esm/generator.js",
  "tsed-prisma-esm": "lib/esm/generator.js"
}

Prisma resolves provider = "tsed-prisma" to node_modules/.bin/tsed-prisma and executes it directly. Without #!/usr/bin/env node the kernel has no interpreter directive, falls back to /bin/sh, and the shell tries to parse ESM as a shell script.

The first line of package/lib/esm/generator.js in each published tarball:

Version First line
8.34.0 #!/usr/bin/env node ✅
8.35.0 import { generate } from "./cli/prismaGenerator.js"; ❌
8.36.0 import { generate } from "./cli/prismaGenerator.js"; ❌
8.37.0 import { generate } from "./cli/prismaGenerator.js"; ❌

The bin mapping and the build script (rm -rf lib && yarn build:ts && monorepo build-hybrid) are identical between 8.34.0 and 8.35.0, so this looks like a change in build-tool output rather than an intentional config change. The import order at the top of the emitted file also changed between the two versions, which is consistent with a bundler/emit change dropping the shebang banner.

To Reproduce

Verify directly from the published tarballs, no project required:

for v in 8.34.0 8.35.0 8.36.0 8.37.0; do
  curl -sL "$(npm view @tsed/prisma@$v dist.tarball)" -o "ver-$v.tgz"
  printf "%-8s %s\n" "$v" "$(tar -xzOf "ver-$v.tgz" package/lib/esm/generator.js | head -1)"
done

In a project:

  1. Install @tsed/prisma@8.37.0.
  2. Add to schema.prisma:
    generator tsed {
      provider = "tsed-prisma"
    }
  3. Run prisma generate.

Result:

Error: Generator "tsed-prisma" failed:

node_modules/.bin/tsed-prisma: line 1: import: command not found
node_modules/.bin/tsed-prisma: line 2: import: command not found
node_modules/.bin/tsed-prisma: line 3: import: command not found
node_modules/.bin/tsed-prisma: line 4: const: command not found
node_modules/.bin/tsed-prisma: line 4: //: is a directory
node_modules/.bin/tsed-prisma: line 5: syntax error near unexpected token `('
node_modules/.bin/tsed-prisma: line 5: `export const defaultOutput = join(rootDir, "..", ".schema");'

Pinning @tsed/prisma back to 8.34.0 resolves it.

Expected behavior

lib/esm/generator.js keeps its #!/usr/bin/env node shebang when published, so the tsed-prisma bin is executable by Prisma as it was through 8.34.0.

OS

macOS 26.5.2 (also applies to any POSIX platform, since the failure is in shebang resolution)

Node version

v24.13.0

Library version

@tsed/prisma 8.35.0 – 8.37.0 (regression introduced in 8.35.0; 8.34.0 works)

Additional context

Adjacent versions: prisma 7.8.0, Yarn 4.17.0 (node-modules linker).

Workarounds for anyone hitting this before a fix lands:

  • pin @tsed/prisma to 8.34.0, or
  • invoke the generator through node instead of the bin name:
    generator tsed {
      provider = "node node_modules/@tsed/prisma/lib/esm/generator.js"
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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