Skip to content

Bun support #632

@enesflow

Description

@enesflow

Environment details

  • OS: macOS
  • OS version: Ventura 13.5.2 (22G91)
  • node-pty version: 1.0.0

Issue description

Does not work with bun (https://bun.sh)

index.ts

import pty from "node-pty";
const subprocess = pty.spawn("bash", [], {});

error

$ bun run --watch src/index.ts

error: Cannot find module "../build/Debug/pty.node" from "/Users/enes/Code/app/node_modules/node-pty/lib/unixTerminal.js"

error: Cannot find module "../build/Release/pty.node" from "/Users/enes/Code/app/node_modules/node-pty/lib/unixTerminal.js"

I've tried building it with node-gyp

$ cd node_modules/node-pty
$ bunx node-gyp-build

This creates the build/Release folders and its contents, but now it gives this vague error:

$ bun run --watch src/index.ts
dyld[5963]: missing symbol called
error: script "dev" exited with code 9 (SIGKILL)

package.json

{
	"name": "app",
	"version": "1.0.0",
	"module": "src/index.ts",
	"devDependencies": {
		"bun-types": "latest"
	},
	"scripts": {
		"test": "echo \"Error: no test specified\" && exit 1",
		"dev": "bun run --watch src/index.ts"
	},
	"dependencies": {
		"node-pty": "^1.0.0"
	}
}

tsconfig.json

{
  "compilerOptions": {
    "target": "ES2021",
    "module": "ES2022",
    "moduleResolution": "node",
    "types": [
      "bun-types"
    ],
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true
  }
}

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