BrowserSync / browser-sync

Keep multiple browsers & devices in sync when building websites. https://browsersync.io
https://discord.gg/2d2xUThp
Apache License 2.0
12.17k stars 754 forks source link

Cannot install Browser-sync with ' npm install -g browser-sync ' #1655

Open abhinavjedi opened 5 years ago

abhinavjedi commented 5 years ago

Issue details

I am trying to install Browser-sync with npm using 'npm install -g browser-sync' but I am not able to do so I am getting the following out put and when I check it with "browser-sync --version" it says there is no such command. I am on windows and using cmd. What is the problem?

Steps to reproduce/test case

Please provide necessary steps for reproduction of this issue, or better the reduced test case (without any external dependencies).

Please specify which version of Browsersync, node and npm you're running

Affected platforms

Browsersync use-case

If CLI, please paste the entire command below

{

C:\Windows\system32>npm install -g browser-sync

C:\Users\Vaibhav WEB\AppData\Roaming\npm\browser-sync -> C:\Users\Vaibhav WEB\AppData\Roaming\npm\node_modules\browser-sync\dist\bin.js

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\browser-sync\node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ browser-sync@2.26.3 added 343 packages in 92.853s

C:\Windows\system32>browser-sync --version 'browser-sync' is not recognized as an internal or external command, operable program or batch file.

C:\Windows\system32>

}

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

{Browsersync init code here}

priyankachakraborty21 commented 4 years ago

npm ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! network request to https://registry.npmjs.org/browser-sync failed, reason: connect ETIMEDOUT 104.16.26.35:443 npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\PRIYANKA\AppData\Roaming\npm-cache_logs\2020-01-25T09_29_49_779Z-debug.log

mohsin922 commented 4 years ago

npm ERR! Unexpected end of JSON input while parsing near '...I5OWtHOsX323i5ha/kk4Y'

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\MOHSIN ZAHOOR PEER\AppData\Roaming\npm-cache_logs\2020-04-19T14_04_52_447Z-debug.log

ashvish183 commented 4 years ago

npm ERR! Unexpected end of JSON input while parsing near '...I5OWtHOsX323i5ha/kk4Y'

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\MOHSIN ZAHOOR PEER\AppData\Roaming\npm-cache_logs\2020-04-19T14_04_52_447Z-debug.log

same problem bro have you got any solution yet

surabhi1408 commented 4 years ago

C:\Users\surab\AppData\Roaming\npm\browser-sync -> C:\Users\surab\AppData\Roaming\npm\node_modules\browser-sync\dist\bin.js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\browser-sync\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

PrathmeshUpadhyay commented 4 years ago

C:\Users\Admin>browser-sync --version YError: Invalid first argument. Expected boolean or string but received function. at argumentTypeError (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\node_modules\yargs\build\lib\argsert.js:64:11) at C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\node_modules\yargs\build\lib\argsert.js:45:17 at Array.forEach () at Object.argsert (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\node_modules\yargs\build\lib\argsert.js:38:25) at Object.version (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\node_modules\yargs\build\lib\yargs.js:796:19) at runFromCli (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\dist\bin.js:46:10) at Object. (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\dist\bin.js:38:5) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) at Module.load (internal/modules/cjs/loader.js:986:32) [Function]

0Neeraj0 commented 4 years ago

C:\Users\Admin>browser-sync --version YError: Invalid first argument. Expected boolean or string but received function. at argumentTypeError (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\node_modules\yargs\build\lib\argsert.js:64:11) at C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\node_modules\yargs\build\lib\argsert.js:45:17 at Array.forEach () at Object.argsert (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\node_modules\yargs\build\lib\argsert.js:38:25) at Object.version (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\node_modules\yargs\build\lib\yargs.js:796:19) at runFromCli (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\dist\bin.js:46:10) at Object. (C:\Users\Admin\AppData\Roaming\npm\node_modules\browser-sync\dist\bin.js:38:5) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) at Module.load (internal/modules/cjs/loader.js:986:32) [Function]

@PrathmeshUpadhyay

The new version is 2.26.10.

So here's the fix for those who want to fix the check version error is to roll back to version 2.26.7.

  1. make sure you have either Visual Studio or Visual C++ redistribute instal
  2. uninstall browser-sync use command ------>npm uninstall -g browser-sync
  3. reinstall previous version use command ------>npm install -g browser-sync@2.26.7 Now you can do check version with no error

browser-sync --version

ShaikBabu commented 4 years ago

not working bro

ShaikBabu commented 4 years ago

C:\Program Files\nodejs\node_modules\npm>npm install -g browser-sync@2.26.12 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\browser-sync\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! Unexpected end of JSON input while parsing near '...uSPSYeSLibNps8YC9Kj5e'

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2020-08-06T02_11_49_022Z-debug.log this is the error iam getting can anyone sort this out plsss...

azhar-mohaimi commented 3 years ago

C:\Users\A>npm --version 7.18.1

C:\Users\A>npm install -g browser-sync npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)

added 13 packages, removed 14 packages, changed 176 packages, and audited 190 packages in 10s

6 packages are looking for funding run npm fund for details

found 0 vulnerabilities

Any help?

hporto80 commented 2 years ago

Boa noite,

Estou iniciando meus estudor e estou quebrando a cabeça ao execuntsr o comando gulp start, pois esta trazendo a informação abaixo.

C:\xampp\htdocs>gulp start ReferenceError: primordials is not defined at fs.js:47:5 at req_ (C:\xampp\htdocs\node_modules\natives\index.js:143:24) at Object.req [as require] (C:\xampp\htdocs\node_modules\natives\index.js:55:10) at Object. (C:\xampp\htdocs\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18)

C:\xampp\htdocs>


Verssões: Node - 16.13.2 Composer - 2.2.5

Biruk2k commented 2 years ago

npm ERR! Windows_NT 10.0.19044 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\BIRUK 2K\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "browser-sync" npm ERR! node v16.16.0 npm ERR! npm v2.14.12

npm ERR! primordials is not defined npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request: npm ERR! C:\Users\BIRUK 2K\npm-debug.log

ShadmaanSk commented 1 year ago

I am facing the npm installation error shown as below: C:\Users\shadmaan>npm install -g browser-sync C:\Users\shadmaan\AppData\Roaming\npm\browser-sync -> C:\Users\shadmaan\AppData\ Roaming\npm\node_modules\browser-sync\dist\bin.js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@ 2.3.2 (node_modules\browser-sync\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"> <current: {"os":"win32","arch":"x64">

oftharsh commented 1 year ago

Following are the steps to solve all these problems. Hope it helps:

1) "x packages are looking for funding." when running npm install on a react project. $ npm install packages are looking for funding. run npm fund for details.

   Solution: npm config set fund false --location=global

2) When I run the external tool Browser Sync, I get the error:

'browser-sync' is not recognized as an internal or external command, operable program, or batch file.

Solution:    Go to file explorer and search for browser sync and see where the file is installed.

Then Right-click your computer, in properties, click advanced system settings, then environment variables and add the directory. For me, it was "C:\Users\userName\AppData\Roaming\npm" and save to your environment variables. Then open the cmd and open that directory and then run the browser-sync. Then running browser-sync --version will work. I will link a Youtube video on how to do this.

https://www.youtube.com/watch?v=bEroNNzqlF4

Make sure you edit the Path System Variable when doing so and add C:\Users\userName\AppData\Roaming\npm as a folder.