15

There was another issue open with the same title which has been closed but my error could not be resolved using the solutions given in that issue.

  • Mac OSX El Capitan
  • Node [v5.6.0]
  • Npm [v3.6.0]

I installed Browser-Sync successfully using : bash $ sudo npm install -g browser-sync

but when I check the browser-sync version by typing : bash $ browser-sync --version

I get this error : bash -bash: browser-sync: command not found

6
  • How did you install node and npm? Can you please post your PATH environment variable? Commented Feb 19, 2016 at 8:21
  • @bolav : Here is my $PATH : screen shot 2016-02-19 at 11 19 43 pm Commented Feb 19, 2016 at 17:51
  • 1
    Please run npm bin -g Commented Feb 19, 2016 at 18:50
  • @bolav : Screenshot Commented Feb 19, 2016 at 18:56
  • You wrote export PATH=~/Users/islahul/.npm-packages/bin:$PATH. Try this export PATH=/Users/islahul/.npm-packages/bin:$PATH Commented Feb 19, 2016 at 18:59

3 Answers 3

19

Check where npm installs it's binaries by running npm bin -g, and then add that to your PATH.

export PATH=$PATH:/usr/local/bin 
Sign up to request clarification or add additional context in comments.

3 Comments

Is this correct? screen shot 2016-02-19 at 11 34 08 pm If yes, I am still not being able to access browser-sync. Please help.
@FaheemHassanZunjani export PATH=/Users/islahul/.npm-packages:$PATH Just remove the tilde character
@bolav I've been stuck on this for hours. Best Answer. Thank you.
6

None of this was helpful to me, instead what I did was find the file location of browser sync after i executed the browser-sync download command supplied on their website. npm install -g browser-sync

Turns out my windows 10 put that downloaded file into %appdata% folder which is in Local Disk (C), but it's an invisible folder and not the correct place it should be, it needs to be in the nodejs folder inside Program Files...

So to find this folder do this: in the search bar of windows 10 type in %appdata% and press Enter, it should open up that hidden folder...

Then click on npm > npm_modules > then you should see files saying browser-sync. Highlight and drag all those files into Local Disk (C) > Program Files > nodejs. You will get allow access prompts, just allow all those.

Now browser-sync and nodejs are sitting happily together and NOW, you can go back to your CMD window and type in browser-sync --version and get the correct version.

I am taking the Coursera class titled HTMl, CSS, and Javascript for Web Developers and ran into this very problem and this solution made it possible for me to continue setting up my environment to take the class.

Comments

0

Although above answers are correct, there is an easy way to handle this. Instead of explicitly creating $PATH we can install Browsersync globally.

npm i -D browser-sync

Here -g option specifies npm to install browser-sync package globally and add $PATH automatically. Next check wether it is working or not by running:

browser-sync --version

Note: Even if you already installed Browsersync try running this. The issue will be resolved.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.