Search code examples
node.jsbashnpmjspm

-bash: jspm: command not found


I am trying to npm install JSPM, so that I can run jspm init, for instance.

npm install -g jspm

is unfortunately not enabling the jspm cli.

npm install jspm --save-dev

in project root, isn't doing the trick either.

node -v = v6.2.1
npm -v = 3.9.3
echo $PATH = /usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/git/bin:/usr/local/bin:/usr/local/git/bin:/usr/local/bin

The error

-bash: jspm: command not found

occurs after running jspm init, or jspm.

OS: OS X El Capitan version 10.11.3

Symlink when running an npm install -g jspm

/Users/user/.npm-packages/bin/jspm -> /Users/user/.npm-packages/lib/node_modules/jspm/jspm.js
/Users/user/.npm-packages/lib

My thanks as always :)


Solution

  • In the end after thinking through the answer here is what I did to solve this problem.

    ONE

    I searched around and found that my $PATH variable was located here ~/.profile

    so running

    emacs ~/.profile 
    

    I was able to edit path directly from my terminal(Iterm).

    TWO

    I made sure to remove any duplicate filepaths and to make sure that all default paths went first, so that my local paths would override them. It ended up looking like this

    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/sbin:/usr/local/git/bin:/usr/local/mysql/bin:/usr/local/bin
    

    THREE

    In addition, I realized that if any path was missing it would be the

    /Users/user/.npm-packages/bin 
    

    filepath. I added it, where user would be your name. In my case charlie, so

    /Users/charlie/.npm-packages/bin. 
    

    That did it, running jspm worked as expected. NOICE!

    FINAL $PATH

    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/sbin:/usr/local/git/bin:/usr/local/mysql/bin:/usr/local/bin:/Users/charlie/.npm-packages/bin