-1

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 :)

Charlie-Greenman
  • 1,469
  • 1
  • 16
  • 36

3 Answers3

1

You might need to add it to your environment variables.

In windows add the following line on your path environment variables:

%appdata%\npm

In OS X it might be something like (I am not sure about the exact syntax but it might give you some direction):

~/.bash_profile
export PATH=$PATH:.
Brenda Jimenez
  • 751
  • 1
  • 7
  • 12
  • In addition, I am going to look at the duplicates in my path, in addition to local being default and usr/bin default overriding local. This article to understanding paths(especially on mac), is helpful https://coolestguidesontheplanet.com/add-shell-path-osx/ – Charlie-Greenman Jun 16 '16 at 19:34
  • Another resource that helps for this, allowing one to find actual files on mac where $PATH is concatenated from: http://stackoverflow.com/questions/9832770/where-is-the-default-terminal-path-located-on-mac – Charlie-Greenman Jun 16 '16 at 19:40
  • Please [format your code properly](http://meta.stackexchange.com/a/22189/248777); also, you probably mean OS X, not iOS. – mklement0 Jun 17 '16 at 04:30
1

I fixed this by running the installation as sudo:

npm install jspm -g

A lot of the other posts had elaborate workarounds involving NVM, editing permissions on bash files, etc. but I'm too busy and just need this to work.

Brian Birtle
  • 627
  • 7
  • 15
0

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
Charlie-Greenman
  • 1,469
  • 1
  • 16
  • 36