copilot-emacs / copilot.el

An unofficial Copilot plugin for Emacs.
MIT License
1.82k stars 128 forks source link

Invalid package name #322

Open cvanelteren opened 4 months ago

cvanelteren commented 4 months ago

When trying to install the server I am greeted with an npm error.

/usr/bin/npm -g --prefix /home/casper/.config/emacs/.local/cache/.cache/copilot install copilot-node-server\@1.14.0
npm error code EINVALIDPACKAGENAME
npm error Invalid package name "copilot-node-server\" of package "copilot-node-server\@1.14.0": name can only contain URL-friendly characters.
npm error A complete log of this run can be found in: /home/casper/.npm/_logs/2024-07-01T14_06_46_512Z-debug-0.log

Comint exited abnormally with code 1 at Mon Jul  1 16:06:46
zerolfx commented 4 months ago

I can't help much here. You may want to examine the shell-quote-argument and copilot-install-server functions to find out where the extra \ comes from.

cvanelteren commented 4 months ago

I don't see from the source where it may appear from. The code seems fine, i.e.

"install" (format "%s@%s" copilot-server-package-name copilot-version)))

does not have an extra \. Could the @ symbol be automatically escaped?

petergaultney commented 2 months ago

what shell are you using, @cvanelteren ?

I wonder if this is some naive usage of the login shell by emacs. I ran into this myself, and I know I use a non-posix shell.

I did find that a perfectly okay workaround for this issue is to copy-paste the command into my own shell and run (without the incorrect backslash). Then emacs seems to have no problem picking up the new server binary and moving on with its life.

cvanelteren commented 2 months ago

Using nushell (0.96.1).