Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Mix: These dependencies were not found:

I have a fresh install of Laravel 5.4. I as well have the folowing versions installed on my Windows PC node: 6.11.0 npm:5.0.3

I have already run npm install, however, when i run npm run watch, i get the following error

> @ watch C:\xampp\htdocs\tu
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

 10% building modules 1/1 modules 0 active
Webpack is watching the files…
                                                                                                                                95% emitting

 ERROR  Failed to compile with 2 errors                                                                                                                             12:12:42 AM

These dependencies were not found:

* C:\xampp\htdocs\tu\resources\assets\js\app.js in multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
* C:\xampp\htdocs\tu\resources\assets\sass\app.scss in multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

To install them, you can run: npm install --save C:\xampp\htdocs\tu\resources\assets\js\app.js C:\xampp\htdocs\tu\resources\assets\sass\app.scss

I've searched the internet but cant seem to get it working. Any help is appreciated.

like image 531
ahabsy Avatar asked Jul 01 '17 21:07

ahabsy


2 Answers

I was having the exact same issue but Leo_Kelmendi's solution didn't work for me.

Searching on GitHub, I found there is a bug in NPM 5.2.0 that affects Laravel Mix. Read more about it here.

I had to revert NPM to its previous version in order to get my assets compiling again:

$ sudo npm install -g [email protected]

Then, I removed all installed modules:

$ rm -rf node_modules/
$ npm cache clear --force
$ rm -rf package-lock.json

Notice that clearing the cache may take a while.

And, finally, I reinstalled node deps and run the dev script:

$ npm install
$ npm run dev
like image 70
Gustavo Straube Avatar answered Sep 28 '22 13:09

Gustavo Straube


Try to revert to this package.json. You can find it here:

https://github.com/laravel/laravel/blob/c1643bf0c59b6864fc55e09cce3bfafc67d29e2a/package.json

And try to run it again, also make sure, there's a node_modules/moment folder.

like image 29
Leo Avatar answered Sep 28 '22 14:09

Leo