elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.67k stars 300 forks source link

epm:install doesn't work #1334

Closed 72siddharth closed 3 years ago

72siddharth commented 3 years ago

Installed elvish just a day ago, and came across epm. When I try to install a package, epm says its already installed but when I try to use the package it says the module doesn't exist. The directory for the modules also does not exist.

~> use epm
~> epm:install github.com/zzamboni/elvish-modules
=> Package github.com/zzamboni/elvish-modules is already installed.
~> use github.com/zzamboni/elvish-modules/alias
Exception: no such module: github.com/zzamboni/elvish-modules/alias
[tty 2], line 1: use github.com/zzamboni/elvish-modules/alias

When I try to install a non-existent package it still says the module is already installed

~> epm:install random-non-existent-package
=> Package random-non-existent-package is already installed.

Os - Garuda Linux Soaring Elvish Version - v0.15.0

xiaq commented 3 years ago

Can you paste the output of

echo $-lib-dir
test -e $-lib-dir/random-non-existent-package
72siddharth commented 3 years ago
~> echo $-lib-dir
compilation error: 5-14 in [tty]: variable $-lib-dir not found
compilation error: variable $-lib-dir not found
[tty 1], line 1: echo $-lib-dir
~> test -e $-lib-dir/random-non-existent-package
compilation error: 8-17 in [tty]: variable $-lib-dir not found
compilation error: variable $-lib-dir not found
[tty 2], line 1: test -e $-lib-dir/random-non-existent-package
xiaq commented 3 years ago

Oops. Replace $-lib-dir with $epm:-lib-dir, what's the output?

72siddharth commented 3 years ago
~> echo $epm:-lib-dir
compilation error: 5-18 in [tty]: variable $epm:-lib-dir not found
compilation error: variable $epm:-lib-dir not found
[tty 3], line 1: echo $epm:-lib-dir

~> test -e $epm:-lib-dir/random-non-existent-package
compilation error: 8-21 in [tty]: variable $epm:-lib-dir not found
compilation error: variable $epm:-lib-dir not found
[tty 4], line 1: test -e $epm:-lib-dir/random-non-existent-package

I'm guessing this should've returned './elvish/lib'? So does this mean I need to explicitly set the value for lib-dir?

xiaq commented 3 years ago

Hmm, do "use epm" first before running those commands?

72siddharth commented 3 years ago

Oh well, my bad.

~> echo $epm:-lib-dir
/home/sid/.elvish/lib

~> test -e $epm:-lib-dir/random-non-existent-package
0.0064
xiaq commented 3 years ago

Hmm so the test command on your system seems to be off, it's certainly not the standard UNIX test command and that's the cause of the problem. Maybe you built a test program and put it somewhere in your PATH?

epm should be changed to use https://elv.sh/ref/path.html#pathis-dir though, and that'd also avoid such problems.

72siddharth commented 3 years ago

sorry about the test command, completely forgot about it. This is with the standard test command

~> test -e $epm:-lib-dir/random-non-existent-package
Exception: test exited with 1
[tty 26], line 1: test -e $epm:-lib-dir/random-non-existent-package
xiaq commented 3 years ago

Did you remove your own test command from PATH? If so epm:install should work as expected from now on.

72siddharth commented 3 years ago

Ah yes. It works now, thank you.