laravel-mix: Uncaught TypeError: utils.isStandardBrowserEnv is not a function

Just running “npm run watch” and I’m getting the error every 4-5 re-compilations.

Uncaught TypeError: utils.isStandardBrowserEnv is not a function
    at Object.chars (app.js:64325)
    at __webpack_require__ (app.js:20)
    at Object.<anonymous> (app.js:26040)
    at __webpack_require__ (app.js:20)
    at getDefaultAdapter (app.js:10529)
    at Object.<anonymous> (app.js:10538)
    at Object.<anonymous> (app.js:10603)
    at __webpack_require__ (app.js:20)
    at Object.module.exports (app.js:63840)
    at __webpack_require__ (app.js:20)

Everything is at the newest version

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 6
  • Comments: 28 (1 by maintainers)

Most upvoted comments

@davidhoeck is right that this has something to do with the axios library and it’s utils file, but I’m guessing the bug is still somewhere within mix’s own watch config.

Here is a temporary fix: require/import the full axios dist file. All of it’s own internal dependencies will be included and webpack/mix won’t need to load them. The following works for me and solves this very annoying issue.

window.axios = require('axios/dist/axios.js');

Here the same problem when running npm run watch I had to stop and run again to make it work when making any sass change.

To me it happens only if I save .scss files. To fix it i’d just ctrl+s on a .js file.

Adding mix.version() seemed to fix the issue for me

I can confirm that downgrading to extract-text-webpack-plugin@2.1.2 solves the issue for me.

Having the same issue at the moment.

It’s only started happening recently. If I’m using 'npm run watch" and change something in my global scss file and watch as mix recompiles everything, I’ll get the above error as soon as I refresh my webpage on my app.

IF I happen to open say, one of my vue components and immediately save it (forcing npm watch to do a recompile) everything is fixed again.

It’s a little annoying but that’s what I’m doing at the moment to work around it.