laravel-mix: Error: Can't resolve 'process/browser' in exifr
- Laravel Mix Version: 6.0.4 (
npm list --depth=0) - Node Version (
node -v): 14.15.3 - NPM Version (
npm -v): 1.22.10 (yarn) - OS: Mac
Description:
I re-installed my node_modules today and the installed version of Mix was resolved to 6.0.6. With this dependency change, Laravel Mix starts failing with the following error:
ERROR in ./node_modules/exifr/dist/full.esm.mjs 1:293-300
Module not found: Error: Can't resolve 'process/browser' in '/Users/Kether/Trendspek/trendspek/node_modules/exifr/dist'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
webpack compiled with 1 error
error Command failed with exit code 1.
I am able to run my repo successfully from 6.0.0 -> 6.0.3, but it starts throwing this error as soon as I move to 6.0.4 (although the process never exits).
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 21
Ok, the solution in my case was to set
legacyNodePolyfillsoption tofalse.More info on this feature: https://laravel-mix.com/docs/6.0/legacy-node-polyfills
Anyone else having issues with this on the M1 Macbook Pro? I have identical environments setup on my iMac (Intel) and my Macbook (M1) but when I do this on my M1 Macbook it breaks my code. But works fine on my iMac (Intel).
Hello, I have the same issue with Axios package. Laravel Mix fails with the following error:
It works on 6.0.3 and starts throwing this error on 6.0.4
I’ve published 6.0.38. It contains a handful of changes — the fix for this is one of them. I’m gonna close this issue but please feel free to do additional testing and comment if it isn’t.
@thecrypticace I pulled in the master branch recompiled successfully but my site was still broken. I removed the
legacyNodePolyfills: false,recompiled successfully and it seems fixed. Before, if I compiled without thelegacyNodePolyfills: false,it wouldn’t compile and would throw an error. Whatever you changed seems to work.