copilot.el icon indicating copy to clipboard operation
copilot.el copied to clipboard

Invalid package name

Open cvanelteren opened this issue 1 year ago • 4 comments

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

cvanelteren avatar Jul 01 '24 14:07 cvanelteren

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.

zerolfx avatar Jul 03 '24 08:07 zerolfx

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?

cvanelteren avatar Jul 03 '24 21:07 cvanelteren

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.

petergaultney avatar Aug 21 '24 16:08 petergaultney

Using nushell (0.96.1).

cvanelteren avatar Aug 21 '24 16:08 cvanelteren

I think the issue is with nushell, after copying the installation command to bash and running it there, the installation succeeded.

The installation command can be found when you run M-x copilot-install-server, it looks something like this:

path/to/your/npm -g --prefix path/to/your/emacs/config/.local/cache/.cache/copilot install copilot-node-server\@1.27.0

AlonSirota avatar Dec 15 '24 12:12 AlonSirota