unjs / nypm

🌈 Unified Package Manager for Node.js and Bun
MIT License
437 stars 13 forks source link

Throws an odd error when using with Bun #132

Open ryoppippi opened 4 weeks ago

ryoppippi commented 4 weeks ago

Environment

/t/buuuuu ❱ bun --revision
1.1.12+43f0913c3
/t/buuuuu ❱ uname -mprs
Darwin 23.5.0 arm64 armf

Reproduction

mkdir -p example
cd example
bun init -y
bun add nypm@0.3.8

Edit index.ts

import {ensureDependencyInstalled} from 'nypm';
await ensureDependencyInstalled('pathe')

Then

bun run index.ts

Describe the bug

Package is installed, but odd errors come out.

Additional context

addDependency also throws an error, but it seems command ran successfully.

Logs

/t/buuuuu 1m 1.7s ❱ bun run index.ts
bun add v1.1.12 (43f0913c)
1 | export const getStreamContents = async (stream, {init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize}, {maxBuffer = Number.POSITIVE_INFINITY} = {}) => {
2 |     if (!isAsyncIterable(stream)) {
3 |             throw new Error('The first argument must be a Readable, a ReadableStream, or an async iterable.');
            ^
error: Command failed: bun add pathe
The first argument must be a Readable, a ReadableStream, or an async iterable.
      at /private/tmp/buuuuu/node_modules/get-stream/source/contents.js:3:9
      at getStreamContents (/private/tmp/buuuuu/node_modules/get-stream/source/contents.js:1:41)
      at getStreamAsString (/private/tmp/buuuuu/node_modules/get-stream/source/string.js:4:41)
      at /private/tmp/buuuuu/node_modules/execa/lib/stream.js:119:24
      at getSpawnedResult (/private/tmp/buuuuu/node_modules/execa/lib/stream.js:118:33)
      at /private/tmp/buuuuu/node_modules/execa/index.js:118:94
      at /private/tmp/buuuuu/node_modules/execa/index.js:117:24
      at /private/tmp/buuuuu/node_modules/onetime/index.js:18:18
      at /private/tmp/buuuuu/node_modules/execa/lib/promise.js:15:35

Bun v1.1.12 (macOS arm64)

installed pathe@1.1.2