Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

spawn node-gyp ENOENT #586

Closed
linonetwo opened this issue Mar 20, 2023 · 3 comments
Closed

spawn node-gyp ENOENT #586

linonetwo opened this issue Mar 20, 2023 · 3 comments
Assignees
Labels

Comments

@linonetwo
Copy link

linonetwo commented Mar 20, 2023

Environment details

  • OS: MacOS
  • OS version: 13.2.1 (22D68)
  • node-pty version: 0.10.1 (not installed)

Issue description

% pnpm config set python /usr/local/Cellar/python@2/2.7.17_1/bin/python2
% pnpm i node-pty                                                       
Packages: +2
++
Progress: resolved 412, reused 371, downloaded 0, added 0, done
node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty: Running install script, failed in 206ms
.../node_modules/node-pty install$ node scripts/install.js
│ node:events:491
│       throw er; // Unhandled 'error' event
│       ^
│ Error: spawn node-gyp ENOENT
│     at ChildProcess._handle.onexit (node:internal/child_process:283:19)
│     at onErrorNT (node:internal/child_process:476:16)
│     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
│ Emitted 'error' event on ChildProcess instance at:
│     at ChildProcess._handle.onexit (node:internal/child_process:289:12)
│     at onErrorNT (node:internal/child_process:476:16)
│     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
│   errno: -2,
│   code: 'ENOENT',
│   syscall: 'spawn node-gyp',
│   path: 'node-gyp',
│   spawnargs: [ 'rebuild' ]
│ }
│ Node.js v18.12.1
└─ Failed in 206ms at /Users/linonetwo/Desktop/repo/langchain-alpaca/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty

I can see in the node_modules/node-pty/scripts/install.js there is

const gypProcess = spawn(os.platform() === 'win32' ? 'node-gyp.cmd' : 'node-gyp', gypArgs, {
  cwd: path.join(__dirname, '..'),
  stdio: 'inherit'
});

But there is no node-gyp in the folder

截屏2023-03-20 21 58 29

@linonetwo
Copy link
Author

Solved by pnpm i -D node-gyp, which is unusual, normally I don't need to do this.

@laptop-moment
Copy link

Solved by pnpm i -D node-gyp, which is unusual, normally I don't need to do this.

Most modules don't have native code; this one does, hence node-gyp being necessary

node-pty should likely have node-gyp as a dependency to prevent this issue

@Tyriar Tyriar added the debt label May 2, 2023
@rzhao271 rzhao271 assigned deepak1556 and unassigned rzhao271 May 3, 2023
@deepak1556
Copy link
Contributor

Please try with the latest version, the node-gyp dependency is not required since #567

@deepak1556 deepak1556 closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants