denoland/deno

TypeError in fs.close() Node.js compatibility layer during postinstall scripts

Roland0206 opened this issue · 0 comments

TypeError: callback is not a function in Deno's Node.js fs compatibility layer when running npm package postinstall scripts.

The error occurs when packages with native postinstall scripts interact with Deno's Node.js fs compatibility layer. This can manifest either during deno install --allow-scripts (build-time failure) or when running deno task dev (runtime failure).

The stack trace points to a bug in Deno's implementation of fs.close():

error: Uncaught TypeError: callback is not a function
    at ext:deno_node/_fs/_fs_close.ts:17:5
    at callback (ext:deno_web/02_timers.js:58:7)
    at eventLoopTick (ext:core/01_core.js:214:13)

Link to minimal reproduction

Repository

Steps to reproduce

  1. Clone the reproduction repository
  2. Run: docker build . -t deno-tailwind-bug

Expected behavior

The deno install command should complete successfully and the Docker image should build without errors.

Actual behavior

The build fails with a TypeError during postinstall scripts:

Initialize @tailwindcss/oxide@4.1.13: running 'postinstall' script
error: script 'postinstall' in '@tailwindcss/oxide@4.1.13' failed with exit code 1
stderr:
error: Uncaught TypeError: callback is not a function
    at ext:deno_node/_fs/_fs_close.ts:17:5
    at callback (ext:deno_web/02_timers.js:58:7)
    at eventLoopTick (ext:core/01_core.js:214:13)

error: failed to run scripts for packages: @tailwindcss/oxide@4.1.13

Environment

  • Deno Version: 2.5.0
  • OS: Docker (Linux, via official denoland/deno images)
  • Command: deno install --allow-scripts
  • Failing Package: @tailwindcss/oxide@4.1.13 (and other packages with native postinstall scripts)