Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installed NPM via PIP, but get "npm: command not found"

I have Python 2.7 installed on OS X Yosemite 10.10.5. I want to install NPM via PIP, and the command appears successful, and I have a directory named npm in /Library/Python/2.7/site-packages/, but doing anything with NPM yields "command not found."

This is how I installed PIP and NPM:

STEP 1

sudo easy_install pip

gave this as output:

Reading https://pypi.python.org/simple/pip/
Best match: pip 8.1.2
Downloading https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz#md5=87083c0b9867963b29f7aba3613e8f4a
Processing pip-8.1.2.tar.gz
Writing /tmp/easy_install-v4g_ZO/pip-8.1.2/setup.cfg
Running pip-8.1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-v4g_ZO/pip-8.1.2/egg-dist-tmp-5Ku7Ds
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching '.landscape.yml'
warning: no previously-included files found matching 'pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching 'dev-requirements.txt'
warning: no previously-included files found matching 'appveyor.yml'
no previously-included directories found matching '.github'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
Adding pip 8.1.2 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

STEP 2:

sudo -H pip install npm

gave this as output:

Collecting npm
  Using cached npm-0.1.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): optional-django==0.1.0 in /Library/Python/2.7/site-packages (from npm)
Installing collected packages: npm
  Running setup.py install for npm ... done

STEP 3:

npm -v

gave this as output:

-bash: npm: command not found

Here is what is in my $PATH variable, but broken into separate lines for ease of reading. Of note is that I copied these from someone else's machine, and that my machine does not have the /usr/local/lib directory.

/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/opt/local/bin:
/opt/local/sbin:
/usr/local/lib/python2.7:
/usr/local/lib/python2.7/site-packages:
/usr/local/lib/node_modules:
/usr/bin/python2.7:
/Library/Python/2.7/site-packages/npm

I'm no stranger to Linux, but I'm new to OS X, so this could be something obvious I'm overlooking.

like image 620
Ken K Avatar asked Sep 08 '25 12:09

Ken K


1 Answers

the operation you did in step 2

sudo -H pip install npm 

does not install npm on your computer. This command only ask for installing a python package named npm.

The package description is available https://pypi.python.org/pypi/npm/0.1.1 : )

as described on the developper github repository, this python package is designed for "Python bindings and utils for npm".

note This package is UNMAINTAINED.

if you want to install npm you should check the node js web site

like image 187
flams345 Avatar answered Sep 10 '25 04:09

flams345