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:

screen shot 2017-09-16 at 2 50 28 pm
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

Most upvoted comments

The problem still exists. All these people above, including me, have tried to re-install with yarn and yarn run dev no 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_modules doesn’t help, only solution is to install dependencies with npm install and running npm run dev. When we install dependencies with yarn install then npm run dev and yarn run dev don’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 install with yarn 1.1.0 and running yarn run dev after that still gave me the same error.

Then I decided to delete node_modules again and do npm install instead (with npm 5.3.0), and then npm run dev and that worked. Now yarn run dev works 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.