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

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.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 8
  • Comments: 19 (1 by maintainers)

Most upvoted comments

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

npm -g install browser-sync@2.26.7

Hi all, fixed as of browser-sync@2.26.12 😃

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

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 browser-sync@2.26.7