busboy icon indicating copy to clipboard operation
busboy copied to clipboard

Replace 'node:stream' & 'node:util' with 'stream' & 'util'

Open sirgalahadcm opened this issue 1 year ago • 4 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @fastify/[email protected] for the project I'm working on.

ENOENT: no such file or directory, open 'node:stream'

      at Runtime.readFile (node_modules/jest-runtime/build/index.js:1987:21)
      at Object.<anonymous> (node_modules/@fastify/busboy/lib/main.js:3:24)
      at Object.<anonymous> (node_modules/undici/lib/fetch/body.js:3:16)
      at Object.<anonymous> (node_modules/undici/lib/fetch/response.js:4:47)
      at Object.<anonymous> (node_modules/undici/index.js:119:29)
      at Object.<anonymous> (node_modules/@elastic/transport/src/connection/UndiciConnection.ts:36:1)
      at Object.<anonymous> (node_modules/@elastic/transport/src/connection/index.ts:22:1)
      at Object.<anonymous> (node_modules/@elastic/transport/index.js:28:5)
      at Object.<anonymous> (node_modules/@elastic/elasticsearch/index.js:35:5)
      at Object.<anonymous> (node_modules/@elastic/elasticsearch-mock/index.js:24:36)

Here is the diff that solved my problem:

diff --git a/node_modules/@fastify/busboy/lib/main.js b/node_modules/@fastify/busboy/lib/main.js
index 8794beb..de4754f 100644
--- a/node_modules/@fastify/busboy/lib/main.js
+++ b/node_modules/@fastify/busboy/lib/main.js
@@ -1,7 +1,7 @@
 'use strict'
 
-const WritableStream = require('node:stream').Writable
-const { inherits } = require('node:util')
+const WritableStream = require('stream').Writable
+const { inherits } = require('util')
 const Dicer = require('../deps/dicer/lib/Dicer')
 
 const MultipartParser = require('./types/multipart')

This issue body was partially generated by patch-package.

sirgalahadcm avatar Jun 07 '24 15:06 sirgalahadcm

@sirgalahadcm Which node version are you aiming to support?

kibertoad avatar Jun 07 '24 16:06 kibertoad

I am trying to switch from 18 to 20 and this issue came up, but I think now it might be a config issue on my end. All uses of node:something are failing

sirgalahadcm avatar Jun 07 '24 22:06 sirgalahadcm

@sirgalahadcm sounds like you have old node version somewhere in your pipeline. Node 20 should handle these prefixes without a hitch

kibertoad avatar Jun 08 '24 08:06 kibertoad

I read: jest-runtime If there are some mocks, they should be updated

Eomm avatar Jun 16 '24 12:06 Eomm