sourcegraph/src-cli

Unable to install npm package on Windows

DanTup opened this issue · 2 comments

If I run npm install -g @sourcegraph/src I get the following output:

PS C:\Dev\Sourcegraph\cody> npm install -g @sourcegraph/src
npm ERR! code 1
npm ERR! path C:\Users\danny\AppData\Roaming\npm\node_modules\@sourcegraph\src
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node install.js
npm ERR! Downloading https://github.com/sourcegraph/src-cli/releases/download/5.2.1/src-cli_5.2.1_windows_amd64.tar.gz
npm ERR! node:internal/fs/utils:350
npm ERR!     throw err;
npm ERR!     ^
npm ERR!
npm ERR! Error: ENOENT: no such file or directory, chmod 'src.exe'
npm ERR!     at Object.chmodSync (node:fs:1991:3)
npm ERR!     at Unpack.<anonymous> (C:\Users\danny\AppData\Roaming\npm\node_modules\@sourcegraph\src\install.js:60:36)
npm ERR!     at Unpack.emit (node:events:517:28)
npm ERR!     at C:\Users\danny\AppData\Roaming\npm\node_modules\@sourcegraph\src\node_modules\tar\lib\parse.js:235:25
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
npm ERR!   errno: -4058,
npm ERR!   syscall: 'chmod',
npm ERR!   code: 'ENOENT',
npm ERR!   path: 'src.exe'
npm ERR! }
npm ERR!
npm ERR! Node.js v18.18.2

npm ERR! A complete log of this run can be found in: C:\Users\danny\AppData\Local\npm-cache\_logs\2023-11-26T12_06_26_509Z-debug-0.log

It's not clear to me if the download is failing (that URL appears correct) or if chmod is failing to find src.exe. There's not much more detail in the full log:

2023-11-26T12_06_26_509Z-debug-0.log

I'm using Windows 11:

image

With these versions of node/npm:

PS C:\Dev\Sourcegraph\cody> node --version
v18.18.2
PS C:\Dev\Sourcegraph\cody> npm --version
10.1.0

Thank you for reporting! Seems like this might get fixed by using executableName here instead of "src"

https://github.com/sourcegraph/src-cli/blob/main/npm-distribution/install.js#L59

I'll try to reproduce and fix on my Windows computer

Took a while for me to get back to this! This should be fixed in the next release (I think targeted for July 10th)