Even if you managed to resolve this, I'd like to suggest trying to understand what is actually going on here a bit better. First, let's go back to your original error message:
Command 'pnpm' not found
The reason this happens is that your shell (probably bash) cannot find the pnpm
binary anywhere it's told to look. So where is it told to look? You can find this out by simply having a look at what's in your $PATH
variable:
echo $PATH
A relatively normal output may look something like:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/lib/snapd/snap/bin:/root/bin
This is a colon separated list of "places to look", so the reason you can simply write ls
in your terminal for example is that bash knows to look for it, and finds it, in one of those folders. If you want to know where bash finds ls
, you can do:
# whereis ls
ls: /usr/bin/ls (...)
So, if I were you, I would try to figure out:
- What do you actually want to happen when you type
pnpm
, where is that binary located?
- Ensure that the directory where that binary is located is a part of your $PATH variable
Based on the output provided in your question, I'm going to assume you want pnpm
to mean /home/rajdeepsingh/.local/share/pnpm/pnpm
. First, you can test this by running the binary with its full path, like:
$ /home/rajdeepsingh/.local/share/pnpm/pnpm
As you mentioned in your comment, is location is not in your PATH, which explains why bash doesn't know how to find the binary:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
This path looks not only completely different, it has nothing from your .bashrc
. So what's happening? Why are you forced to specify -i
for interactive mode?
Well, you have this in your .bashrc
:
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
I have no idea why you have this, because it's not a part of any standard .bashrc
that I know of. A basic standard example could look like:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
So, the reason you have to run bash -i
is not because "that's how it works", it's because you yourself (or someone else) have added a constraint into .bashrc
that simply exits if you are not running bash -i
.
My suggestion to you: start over. Create a new .bashrc
and set things up exactly as you want them, because it's not complicated, but you're making it very complicated.
Your .bashrc
could probably look like this:
# Source global definitions (system-wide)
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment (default)
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
#( *** your config here, not related to PATH *** )
export PATH=$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH
export PATH=/home/rajdeepsingh/.bun/bin:$PATH
export PATH=$PATH:$HOME/Android/Sdk/tools
export PATH=$PATH:/home/rajdeepsingh/Android/Sdk/platform-tools/
export PATH=/home/rajdeepsingh/.local/share/pnpm:$PATH
export PATH=/home/rajdeepsingh/.deno/bin:$PATH
export PATH=/home/rajdeepsingh/.surrealdb:$PATH
# export PATH="/usr/local/bin:$PATH" <- pointless, /usr/local/bin is part of
# any normal path definition
Try that, then source ~/.bashrc
then echo $PATH
.