Browser-sync: [2.26.10] YError: Invalid first argument. Expected boolean or string but received function.

Created on 20 Jul 2020  Â·  18Comments  Â·  Source: BrowserSync/browser-sync

Issue details

Getting the version or just running browser-sync outputs this error:

# browser-sync --version
YError: Invalid first argument. Expected boolean or string but received function.
    at argumentTypeError (/usr/lib/node_modules/browser-sync/node_modules/yargs/build/lib/argsert.js:64:11)
    at /usr/lib/node_modules/browser-sync/node_modules/yargs/build/lib/argsert.js:45:17
    at Array.forEach (<anonymous>)
    at Object.argsert (/usr/lib/node_modules/browser-sync/node_modules/yargs/build/lib/argsert.js:38:25)
    at Object.version (/usr/lib/node_modules/browser-sync/node_modules/yargs/build/lib/yargs.js:796:19)
    at runFromCli (/usr/lib/node_modules/browser-sync/dist/bin.js:46:10)
    at Object.<anonymous> (/usr/lib/node_modules/browser-sync/dist/bin.js:38:5)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
[Function]

It doesn't produce an exit code so my Travis-CI builds continued to push it to my repos and breaks my stack's updater. Very bad.

Build log: https://travis-ci.org/github/demyxco/browsersync/builds/709580148

Steps to reproduce/test case

  • npm -g install browser-sync
  • browser-sync --version

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

  • Browsersync [ 2.26.10 ]
  • Node [ v12.15.0 ]
  • Npm [ 6.13.4 ]

Affected platforms

  • [ ✅ ] linux
  • [ ] windows
  • [ ] OS X
  • [ ] freebsd
  • [ ] solaris
  • [ ] other _(please specify which)_

Browsersync use-case

  • [ ] API
  • [ ] Gulp
  • [ ] Grunt
  • [ ✅ ] CLI

If CLI, please paste the entire command below

No issues, works fine even with that exit 0 error.

Most helpful comment

You all will have to downgrade since 2.26.9 is affected as well.

npm -g install [email protected]

All 18 comments

Same issue.

New user here...

Windows 10 x64

New install.
Node v 12.18.2
npm v6.14.4

Same issue, tried both version of nodejs as well, still made no difference.
Windows 10 64bit
Node v12.18.2
npm v6.14.5

You all will have to downgrade since 2.26.9 is affected as well.

npm -g install [email protected]

Same issue. Downgrading to 2.26.7 isn't great under NodeJS 14+ since it wants fsevents 2 and that version of browser-sync is using fsevents 1.

I'm also seeing this issue and would appreciate a fix. It does seem to be a warning rather than an error, so I am using browsersync OK at version 2.26.10, but it is muddying the tooling console output. Using node v14.3.0.

On OSX too

Hi, my website is using php files, and after I start browser-sync , it shows Cannot GET /.
I typed browser-sync start --server --files="./.jsx, ./.css" to start the browser-sync.
Is it wrong? What should I type?
Thank you very much.

Tried on Windows 10 & OSX
Node v12.18.2
npm v6.14.5

For windows: Error stopped showing when I downgraded to 2.26.10
For OSX: I can't get it to work even with version 2.26.10

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

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

C:\Users\GODFRED>

the browser sync is not installing, i need assistance am new to programming

Versions:
Browser-sync --version command not working ("Invalid first argument")
node 12.16.1
npm 6.13.4

Windows OS
Using CLI.

Pls help. Have also asked the question in SPA Angularjs course Discussion Forum, taught by @ychaikin ...

Just do same as mention by Author demyxco and sir Yaakov Chaikin.
@hackothaurus
@Godfrey111
You all will have to downgrade since 2.26.9 is affected as well.
You can run this directly without uninstalling old ones

npm -g install [email protected]

When I install version 2.26.7 I get vulernability warning:

  High            Denial of Service                                             

  Package         http-proxy                                                    

  Dependency of   browser-sync [dev]                                            

  Path            browser-sync > http-proxy                                     

  More info       https://npmjs.com/advisories/1486    

Is the annoying warning message preferable to this vulernability?

Please give me the needed steps to follow to resolve the issue.

On Sun, Jul 26, 2020, 10:02 AM Yesh123456 notifications@github.com wrote:

Just do same as mention by Author demyxco and sir Yaakov Chaikin.
@hackothaurus https://github.com/hackothaurus
You all will have to downgrade since 2.26.9 is affected as well.
You can run this directly without uninstalling old ones

npm -g install [email protected]

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/BrowserSync/browser-sync/issues/1782#issuecomment-663961320,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AQLUPFPJOD3LV6LJPPEGVALR5PWJ7ANCNFSM4PCSH35A
.

image

Okay, so it's not giving an error anymore, but it's still not loading my js files or processing angular js. Although when I open index.html without browser-sync, it works. So there's something wrong with my browser-sync command, I imagine? I'm writing "browser-sync start --server --directory --files "*/"" in my directory that contains index.html, app.js and angular.min.js.
Can you figure out why this is happening? @Yesh123456

Hi all, fixed as of [email protected] :)

@shakyShane thanks, works like it should.

What should I do sir, it showing error, when I try to check command prompt
to check if it installed it not showing.

Please give me steps to get this set up, am stucked

On Sun, Jul 26, 2020, 9:07 PM Demyx notifications@github.com wrote:

@shakyShane https://github.com/shakyShane thanks, works like it should.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/BrowserSync/browser-sync/issues/1782#issuecomment-664034009,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AQLUPFOT7AAM726GEIXXACTR5SEH5ANCNFSM4PCSH35A
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

demisx picture demisx  Â·  4Comments

codeofsumit picture codeofsumit  Â·  3Comments

ericmorand picture ericmorand  Â·  3Comments

sedubois picture sedubois  Â·  3Comments

zewa666 picture zewa666  Â·  3Comments