Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Unable to install npm package on Windows #1050

Closed
DanTup opened this issue Nov 26, 2023 · 2 comments · Fixed by #1098
Closed

Unable to install npm package on Windows #1050

DanTup opened this issue Nov 26, 2023 · 2 comments · Fixed by #1098

Comments

@DanTup
Copy link

DanTup commented Nov 26, 2023

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
@DanTup DanTup changed the title Unable to install on Windows Unable to install npm package on Windows Nov 26, 2023
@olafurpg
Copy link
Member

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

olafurpg added a commit that referenced this issue Jul 3, 2024
Fixes #1050. Previously, it was not possible to install src-cli via npm
on Windows. It was also not possible to publish the npm package on
Windows. This PR fixes both problems. The second problem had to be
solved so I could manually test the fix for this PR.:
olafurpg added a commit that referenced this issue Jul 3, 2024
Fixes #1050. Previously, it was not possible to install src-cli via npm
on Windows. It was also not possible to publish the npm package on
Windows. This PR fixes both problems. The second problem had to be
solved so I could manually test the fix for this PR.:
olafurpg added a commit that referenced this issue Jul 3, 2024
Fixes #1050. Previously, it was not possible to install src-cli via npm
on Windows. It was also not possible to publish the npm package on
Windows. This PR fixes both problems. The second problem had to be
solved so I could manually test the fix for this PR.:
@olafurpg
Copy link
Member

olafurpg commented Jul 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants