Search code examples
npmgulpenvironment-variablesnode-modulesgit-bash

Changing PATH for npm node_modules


I've been troubleshooting problems with using npm packages for about 2 weeks now. Any node modules (I've tried gulp, gulp-cli, mocha, react, babel, and others) return a "command not found" error in Git Bash.

I have Windows 7 Professional, Node 8.11.1 (64-bit), npm 5.6.0.

What I have tried already is:

In the case of gulp-cli for Lecture 11 of this course

-- Uninstalling the package globally and reinstalling globally

-- Uninstalling and re-installing Node and npm completely

-- Changing the PATH and NODE_PATH of the Environment Variables

User variables

PATH:C:\Program Files\Git\usr\local\node_modules\;C:\Users\Millionaire\AppData\Roaming\npm;

System variables

PATH: C:\Program Files\Git\usr\local\node_modules\;%USERPROFILE%\AppData\Roaming\npm;

$ which node

/c/Program Files/nodejs/node

$which npm

/c/Program Files/nodejs/npm

$ npm list -g

C:\Program Files\Git\usr\local

Any help you can offer is very much appreciated!


Solution

  • I tried a few times to do

    $npm list-g {package name}
    

    for gulp and http-server and others and it kept giving me

    C:\Program Files\Git\usr\local
    

    So I added that to the system PATH environment variable. Exited and restarted Git Bash and it finally worked for me. Hallelujah.