Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to resolve path to module 'stream/promises'

For the following import in a typescript nodejs app

import { pipeline } from "stream/promises";

vscode / eslint is complaining Unable to resolve path to module 'stream/promises'

sample

This started occurring all of a sudden.

node -v v16.13.2
pnpm -v 6.29.1
"@types/node": "^17.0.12"

stream/promises is part of node. I've confirmed that the pipeline function and typescript type exist and work and the overall app still functions.

console.log({ pipeline }); // { pipeline: [Function: pipeline] }

Importing just stream works with no complaints. I've confirmed this error on a Windows 10 and Linux computer. Whats going on and how to resolve it without ignoring it?

like image 560
SILENT Avatar asked Dec 19 '25 06:12

SILENT


1 Answers

Need to make sure your node version is > v15. Note that if you're using nvm, your terminal node version could be different from the version vscode is using. You can see which version you have with nvm unload; node -v. You can consider adding nvm to your rc script files but sometimes it doesn't resolve fast enough and vs code complains.

like image 72
Sam Araiza Avatar answered Dec 20 '25 19:12

Sam Araiza