laravel-mix: Relative modules were not found in Laravel-Mix 1.4.3
- Laravel Mix Version: 1.4.3 (
npm list --depth=0) - Node Version (
node -v): 8.5.0 - NPM Version (
npm -v): 5.4.2 - OS: macOS 10.12.6 / Ubuntu 17.04
Description:
ERROR Failed to compile with 5 errors
These relative modules were not found:
* ./components/Avatar.vue in ./resources/assets/js/frontend.js
* ./components/backend/FooterComponent.vue in ./resources/assets/js/backend.js
* ./components/passport/AuthorizedClients.vue in ./resources/assets/js/backend.js
* ./components/passport/Clients.vue in ./resources/assets/js/backend.js
* ./components/passport/PersonalAccessTokens.vue in ./resources/assets/js/backend.js
This error is not seen in Laravel Mix 1.4.2.
Steps To Reproduce:
Running the command npm run production or yarn production results in the build failing on Laravel Mix 1.4.3.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 23 (9 by maintainers)
Commits related to this issue
- Add esModule: false to vue-loader options for compatibility with vue files loaded using require(). — committed to laravel-mix/laravel-mix by yansern 7 years ago
The problem still exists. All these people above, including me, have tried to re-install with yarn and
yarn run devno longer works if they do. It only works with npm. This issue shouldn’t be closed just because you can’t reproduce the problem.@ruchern But in our case deleting
node_modulesdoesn’t help, only solution is to install dependencies withnpm installand runningnpm run dev. When we install dependencies withyarn installthennpm run devandyarn run devdon’t work. So far with Yarn version from 1.0 to 1.2 (latest stable) building fails, with 0.27.5 it works. If you want I can find out exact Yarn version when building assets started to fail?We have this issue for a few weeks and it’s causing us a pain cause we use Yarn on server in automatic script. Basically it happens only if you install dependencies with Yarn, if you use npm directly then everything works. Oh, I also noticed that everything works fine if you’re using Yarn 0.27.5. From 1.0 it doesn’t work anymore. So it may be issue completely caused by Yarn. Unfortunately my knowledge about NPM, Yarn and whole tooling story is very basic so I don’t know what to do.
Well, I don’t know what the deal was, but I eventually got it to work with this. It didn’t initially work, so I had to completely delete my node_modules folder. I then tried doing
yarn installwith yarn 1.1.0 and runningyarn run devafter that still gave me the same error.Then I decided to delete node_modules again and do
npm installinstead (with npm 5.3.0), and thennpm run devand that worked. Nowyarn run devworks too. I have no idea why or how that happened.@ruchern Sadly that did not work 😦. I dumped everything in node_modules again, cleared cache, and then modified my mix file to include setting esModule to true like so:
mix.js('resources/assets/js/app.js', 'public/js') .sass('resources/assets/sass/app.scss', 'public/css').options({ processCssUrls: false }) .copyDirectory('resources/assets/images', 'public/img') .webpackConfig({ plugins: usePlugins, }) .options({ vue: { esModule: true } });But I’m still getting the same error as before (“These relative modules were not found”).
@xmoroccan i actually do not have this problem now.