Browser-sync: Error('no parsers registered for: "' + self.input.slice(0, 5) + '"')

Created on 23 Oct 2018  路  17Comments  路  Source: BrowserSync/browser-sync

After updating to 2.26.3 Browsersync is throwing an error when used with webpack and webpack-dev-server:

[Browsersync] Watching files...
.../node_modules/snapdragon/lib/parser.js:473
        throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
        ^

Error: no parsers registered for: "]a(r)"
    at parse (.../node_modules/snapdragon/lib/parser.js:473:15)
    at Parser.parse (.../node_modules/snapdragon/lib/parser.js:477:24)
    at Snapdragon.parse (.../node_modules/snapdragon/index.js:122:28)
    at Snapdragon.<anonymous> (.../node_modules/braces/lib/braces.js:40:45)
    at Braces.parse (.../node_modules/braces/lib/braces.js:66:26)
    at Braces.expand (.../node_modules/braces/lib/braces.js:87:18)
    at create (.../node_modules/braces/index.js:142:15)
    at memoize (.../node_modules/braces/index.js:298:13)
    at Function.braces.create (.../node_modules/braces/index.js:165:10)
    at Function.braces.expand (.../node_modules/braces/index.js:81:17)
    at getDirParts (.../node_modules/chokidar/index.js:435:31)
    at FSWatcher.<anonymous> (.../node_modules/chokidar/index.js:452:24)
    at .../node_modules/readdirp/readdirp.js:220:72
    at Array.filter (<anonymous>)
    at.../node_modules/readdirp/readdirp.js:220:12
    at .../node_modules/readdirp/readdirp.js:193:38
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] hmr: `webpack-dev-server --env development --config resources/assets/webpack/config.base.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] hmr script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

The npm debug log is this:

0 info it worked if it ends with ok
1 verbose cli [ '/home/yahzee/.nvm/versions/node/v10.9.0/bin/node',
1 verbose cli   '/home/yahzee/.nvm/versions/node/v10.9.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'hmr' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prehmr', 'hmr', 'posthmr' ]
5 info lifecycle [email protected]~prehmr: [email protected]
6 info lifecycle [email protected]~hmr: [email protected]
7 verbose lifecycle [email protected]~hmr: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~hmr: PATH: /home/yahzee/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/d/Sites/moviefy/node_modules/.bin:/home/yahzee/bin:/home/yahzee/.local/bin:$9 verbose lifecycle [email protected]~hmr: CWD: /mnt/d/Sites/moviefy
10 silly lifecycle [email protected]~hmr: Args: [ '-c',
10 silly lifecycle   'webpack-dev-server --env development --config resources/assets/webpack/config.base.js' ]
11 silly lifecycle [email protected]~hmr: Returned: code: 1  signal: null
12 info lifecycle [email protected]~hmr: Failed to exec hmr script
13 verbose stack Error: [email protected] hmr: `webpack-dev-server --env development --config resources/assets/webpack/config.base.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/yahzee/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/home/yahzee/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:961:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)
14 verbose pkgid [email protected]
15 verbose cwd /mnt/d/Sites/moviefy
16 verbose Linux 4.4.0-17763-Microsoft
17 verbose argv "/home/yahzee/.nvm/versions/node/v10.9.0/bin/node" "/home/yahzee/.nvm/versions/node/v10.9.0/bin/npm" "run" "hmr"
18 verbose node v10.9.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] hmr: `webpack-dev-server --env development --config resources/assets/webpack/config.base.js`
22 error Exit status 1
23 error Failed at the [email protected] hmr script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I tried installing previous versions and 2.25.0 works fine. Version 2.26 "works" if I remove the _files_ option, but then of course Browsersync won't watch for changes at all.

The relevant part of my webpack config file is this:

devServer: {
    hot: true,
    overlay: true,
    stats: 'errors-only'
  },

  plugins: [
    new BrowserSyncPlugin(
      {
        host: process.env.BS_HOST,,
        port: process.env.BS_PORT,
        proxy: process.env.BS_PROXY,
        files: [
          {
            match: [
              '**/*.blade.php'
            ],
            fn (event, file) {
              if (event === 'change') {
                const bs = require('browser-sync').get('bs-webpack-plugin')
                bs.reload()
              }
            }
          }
        ],
        open: false
      },
      {
        reload: false
      }
    ),

    new webpack.HotModuleReplacementPlugin(),

    new webpack.NamedModulesPlugin()
  ]
  • Browsersync [2.26.0]
  • Node [10.9.0]
  • Npm [6.4.1]
  • WSL on Windows 10

Most helpful comment

Yeah its basically because it has too much files to handle or cannot parse some of the files. If I specify only few files it works properly.

I experienced the bug when my Browsersync configuration files array allowed for watching the dir where Composer's vendor folder was present. Thanks to the comment above I changed files array to exclude vendor folder and left there only folders that I really need BS to watch. No bug anymore.

All 17 comments

I tried using Browsersync on its own without Webpack or any other packages and just a bs-config.js file and I got the same error

My config file only contains:

module.exports = {
  files: "**/*.php"
}

And I'm running Browsersync like so browser-sync start --config bs-config.js

I can confirm this issue with gulp and the following files property:

files: ['**/*.htm', '**/*.yaml', '../../plugins/**/*.php', '../../plugins/**/*.htm']
  • Git Bash
  • Windows 10
  • Node 7
  • browser-sync 2.26.3
[10:43:42] Error: no parsers registered for: "]a(r)"
   at parse (C:\redacted\node_modules\snapdragon\lib\parser.js:473:15)
   at Parser.parse (C:\redacted\node_modules\snapdragon\lib\parser.js:477:24)
   at Snapdragon.parse (C:\redacted\node_modules\snapdragon\index.js:122:28)
   at Snapdragon.<anonymous> (C:\redacted\node_modules\braces\lib\braces.js:40:45)
   at Braces.parse (C:\redacted\node_modules\braces\lib\braces.js:66:26)
   at Braces.expand (C:\redacted\node_modules\braces\lib\braces.js:87:18)
   at create (C:\redacted\node_modules\braces\index.js:142:15)
   at memoize (C:\redacted\node_modules\braces\index.js:298:13)
   at Function.braces.create (C:\redacted\node_modules\braces\index.js:165:10)
   at Function.braces.expand (C:\redacted\node_modules\braces\index.js:81:17)
   at getDirParts (C:\redacted\node_modules\chokidar\index.js:435:31)
[10:43:42] 'browser-sync' errored after 22 s

...well, the issues continue. I've been trying to get Browsersync to work properly like it used to, reinstalled Windows and WSL and found out that although 2.25.0 doesn't throw any errors and it loads the page, making any additional requests like clicking a link or some AJAX function hangs up the page. Disabling Javascript didn't solve the issue, and navigating the page without Browsersync and just my local virtual host works perfectly. Looks like 2.24.3 is the last version without any issues for me. Am I missing something? Is there any extra requirements for using this package?

I got the same error with a new install of BrowserSync. I reverted to 2.24.3 thanks to @YahzeeSkellington comment and it's working again.

BrowserSync version : 2.26.3
OS : Mac OSX Mojave 10.14
Node : 8.11

From what I've seen most of the plugins which have been using snapdragon as of late are breaking 馃え

Hello, i also have this issue and have had it for awhile can confirm that 2.24.7 is the last known working version

Original issue here: https://github.com/BrowserSync/browser-sync/issues/1620

I rolled back to 2.24.3 and I'm still having this issue.

  1. Could this be something else
  2. Can anyone else confirm that rolling back will fix the issue?

Again on yet another project i've had to rollback.

My command is:
browser-sync start --proxy 'https://site.local' --no-notify --files './styles/**/*.css, ./scripts/**/*.js, ./**/*.html, ./**/*.php, !node_modules/**/*.html'

The error i get is:

[Browsersync] Watching files...
/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/snapdragon/0.8.2/node_modules/snapdragon/lib/parser.js:473
        throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
        ^

Error: no parsers registered for: "]a(r)"
    at parse (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/snapdragon/0.8.2/node_modules/snapdragon/lib/parser.js:

473:15)
    at Parser.parse (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/snapdragon/0.8.2/node_modules/snapdragon/lib/par
ser.js:477:24)
    at Snapdragon.parse (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/snapdragon/0.8.2/node_modules/snapdragon/ind
ex.js:122:28)
    at Snapdragon.<anonymous> (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/braces/2.3.2/node_modules/braces/lib/b
races.js:40:45)
    at Braces.parse (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/braces/2.3.2/node_modules/braces/lib/braces.js:6
6:26)
    at Braces.expand (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/braces/2.3.2/node_modules/braces/lib/braces.js:
87:18)
    at create (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/braces/2.3.2/node_modules/braces/index.js:142:15)
    at memoize (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/braces/2.3.2/node_modules/braces/index.js:298:13)
    at Function.braces.create (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/braces/2.3.2/node_modules/braces/index
.js:165:10)
    at Function.braces.expand (/Users/Matt/Sites/project/node_modules/.registry.npmjs.org/braces/2.3.2/node_modules/braces/index
.js:81:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] serve: `browser-sync start --proxy 'https://site.local' --no-notify --files './styles/**/*.css, ./scripts/**/*.js, ./**/*.html, ./**/*.php, !node_modules/**
/*.html'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Matt/.npm/_logs/2018-12-05T19_42_49_869Z-debug.log

Also the error log is attached
2018-12-05T19_42_49_869Z-debug.log

Here the same issue.
can anyone advice me how to rollback/revert to an older version.
I tried, but can not get it to work.
thanks a lot

Sure thing @hhentschel in your package.json change the browser-sync line to:

"browser-sync": "2.24.7",

After some more testing i have narrowed the bug, it appears to error out when using the proxy option with https. It works without the proxy but with the https.

Hopefully this will help with replication

Thanks @matt3224. now it works with the older version.
now can work at least, will look into it again later.

Any news about that issue?

````
D:\Projects\private\wordpress-webpack-sandbox\node_modules\snapdragon\lib\parser.js:473
throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
^

Error: no parsers registered for: "] Mac"
at parse (D:\Projects\private\wordpress-webpack-sandbox\node_modules\snapdragon\lib\parser.js:473:15)
at Parser.parse (D:\Projects\private\wordpress-webpack-sandbox\node_modules\snapdragon\lib\parser.js:477:24)
at Snapdragon.parse (D:\Projects\private\wordpress-webpack-sandbox\node_modules\snapdragon\index.js:122:28)
at Snapdragon. (D:\Projects\private\wordpress-webpack-sandbox\node_modules\browser-sync\node_modules\braces\lib\braces.js:40:45)
at Braces.parse (D:\Projects\private\wordpress-webpack-sandbox\node_modules\browser-sync\node_modules\braces\lib\braces.js:66:26)
at Braces.expand (D:\Projects\private\wordpress-webpack-sandbox\node_modules\browser-sync\node_modules\braces\lib\braces.js:87:18)
at create (D:\Projects\private\wordpress-webpack-sandbox\node_modules\browser-sync\node_modules\braces\index.js:142:15)
at memoize (D:\Projects\private\wordpress-webpack-sandbox\node_modules\browser-sync\node_modules\braces\index.js:298:13)
at Function.braces.create (D:\Projects\private\wordpress-webpack-sandbox\node_modules\browser-sync\node_modules\braces\index.js:165:10)
at Function.braces.expand (D:\Projects\private\wordpress-webpack-sandbox\node_modules\browser-sync\node_modules\braces\index.js:81:17)
````


EDIT
Issue probably is connected to parsing paths. In my case **/*.php was the culprit, probably becuase was parsing vendor files. I know that this is not an explanation of the problem, but check your files list, maybe you can limit the search or exclude something.

Yeah its basically because it has too much files to handle or cannot parse some of the files. If I specify only few files it works properly.

Not sure if this will help anyone but with my project, I was getting this error. It was due to installing WPCS as a dependency instead of as a standalone. I ultimately removed the vendor directory from my project and everything began working as expected.

Hopefully this saves someone from hours and hours of unnecessary Google searches.

Ran into this bug as well. Restricting the files watched to even 1 file didn't solve issue. Rolling back to 2.24.7 did.

Yeah its basically because it has too much files to handle or cannot parse some of the files. If I specify only few files it works properly.

I experienced the bug when my Browsersync configuration files array allowed for watching the dir where Composer's vendor folder was present. Thanks to the comment above I changed files array to exclude vendor folder and left there only folders that I really need BS to watch. No bug anymore.

What's the resolution? I have this issue on win 10. I recently added the '[]' dynamic path building and this issue started occurring ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jitendravyas picture jitendravyas  路  4Comments

danielverejan picture danielverejan  路  3Comments

kraf picture kraf  路  3Comments

ronilaukkarinen picture ronilaukkarinen  路  4Comments

tonyoconnell picture tonyoconnell  路  3Comments