Fixing error “bash: browserify: command not found”

If you follow the steps on the browserify site, you may find that it does not work afterwards:

npm install -g browserify

When I tried to run browserify, I got this error:

bash: browserify: command not found

In the log output, you will see something like this, which indicates that NPM makes a symlink in the NPM folder (not that my NPM folder is in %AppData% rather than say ~, like most of the internet assumes):

C:\Users\gary\AppData\Roaming\npm\browserify -> C:\Users\gary\AppData\Roaming\npm\node_modules\browserify\bin\cmd.js
browserify@13.0.0 C:\Users\gary\AppData\Roaming\npm\node_modules\browserify
├── https-browserify@0.0.1
├── tty-browserify@0.0.0
├── path-browserify@0.0.0
├── htmlescape@1.1.0
...

On Windows, you can get the AppData location by doing this:

echo %AppData%

Which gives you this value, which you should add to your path:

C:\Users\gary\AppData\Roaming\npm

The “correct” path entry to add would be “%AppData%\npm”, however you shouldn’t do this – I found that git bash could not correctly translate this into the folder, so it isn’t able to resolve the location of NPM.

Leave a Reply

Your email address will not be published. Required fields are marked *