Kunal Kunal - 2 months ago 24
Node.js Question

Browser-sync command not found even after setting the correct path to the environment variable

I am facing a problem which i found some solutions but it is still not working.I installed nodejs for windows 32 bit version, and everything went well.Now when i installed browser-sync via command line running the command

$ npm install -g browser-sync

Now everything got installed correctly with a couple of warnings. Now when i ran the command

$ browser-sync --version

it said browser-sync command not found.So i googled and found out that my environment variable might not be set correctly so it is not picking up my command. So then i tried finding the correct path to be set in the env variable via the following command which gave the result

$ npm bin -g
(not in PATH env variable)

So i tried adding the path via the command

$ PATH %PATH%;C:\Users\TEMP\AppData\Roaming\npm;npm\npm

But it is still not working.I checked whether the path is actually added directly from the environment editor and via running the command $ Path,and it is actually adding the path but the problem still persists.

I think the problem is with the folder name which has semicolon in it "npm;npm" which is actually used to separate paths.I am not quite sure why it is adding the folder with such a name, i tried renaming it but as soon as i run the command npm bin -g it makes a new folder with the same name.

Also i tried using the short name for the folder which was "NPM_NP~1" to avoid that semicolon issue but it is still not working.

I am stuck with this since past 2 days and hopefully i can find a solution from you guys so i can get on with some actual development work. I gave you guys as much info as i could. Let me know if you need something more and specific.


You need to have NODE_PATH set:

$ set NODE_PATH=%AppData%\npm\node_modules