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

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! spiral@0.6.1 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 spiral@0.6.1 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 npm@6.4.1
3 info using node@v10.9.0
4 verbose run-script [ 'prehmr', 'hmr', 'posthmr' ]
5 info lifecycle spiral@0.6.1~prehmr: spiral@0.6.1
6 info lifecycle spiral@0.6.1~hmr: spiral@0.6.1
7 verbose lifecycle spiral@0.6.1~hmr: unsafe-perm in lifecycle true
8 verbose lifecycle spiral@0.6.1~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 spiral@0.6.1~hmr: CWD: /mnt/d/Sites/moviefy
10 silly lifecycle spiral@0.6.1~hmr: Args: [ '-c',
10 silly lifecycle   'webpack-dev-server --env development --config resources/assets/webpack/config.base.js' ]
11 silly lifecycle spiral@0.6.1~hmr: Returned: code: 1  signal: null
12 info lifecycle spiral@0.6.1~hmr: Failed to exec hmr script
13 verbose stack Error: spiral@0.6.1 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 spiral@0.6.1
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 spiral@0.6.1 hmr: `webpack-dev-server --env development --config resources/assets/webpack/config.base.js`
22 error Exit status 1
23 error Failed at the spiral@0.6.1 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

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 4
  • Comments: 17

Most upvoted comments

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.

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 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 🤨

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.<anonymous> (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.

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

"browser-sync": "2.24.7",