laravel-mix: The Mix manifest does not exist

  • Laravel Mix Version: 1.6.2
  • Node Version : 8.4.0
  • NPM Version : 5.3.0
  • OS: Ubuntu 16
  • Laravel version : 5.4

Description:

I’m trying to install Laravel in a sub-directory, keeping security in mind, my directory structure is as follows

/var/www/laravel/
/var/www/html/demo/

(demo folder is where i prefer to be called as public folder. and things works like a charm except this mix issue.)

After i run npm run dev it creates mix-manifest.json in /var/www/html/demo/ directory along with css and js directories with compiled files.

in my views/auth/layout.blade.php , i have called the versioned asset like this.

<link href="{{ mix('/css/app.css') }}" rel="stylesheet">

And when i reload the page, it says

The Mix manifest does not exist.
in helpers.php (line 548)
at mix('/css/app.css')

in my /var/www/html/demo/ folder, the manifest exists.

{
    "/js/app.js": "/js/app.js?id=62141ada8b6feb788550",
    "/css/app.css": "/css/app.css?id=26d13f158c3bade2b2d3",
}

and here is my webpack.mix.js file contents

let mix = require('laravel-mix');
let path = require('path');
mix.setPublicPath(`..${path.sep}html/demo/`);
mix.js('resources/assets/js/app.js', 'js')
	.sass('resources/assets/sass/app.scss', 'css').version();
  • I can call the css file directly, (<link href="{{ asset('css/app.css') }}" rel="stylesheet">). It works, but i prefer to call with mix versioning.
  • I can call the css file <link href="{{ asset('css/app.css') }}" rel="stylesheet">. It works too. But not with mix.
  • I have tried settings the mix.setResourceRoot('../html/demo/'); and it didnt help.
  • I have tried https://stackoverflow.com/a/45154015 but it doesn’t help either (<link rel="stylesheet" href="{{ mix('css/app.css', '../html/demo') }}">)

Steps To Reproduce:

Install Laravel outside root. (/var/www/laravel) Assume example.com as the server. Create sub directory as example.com/demo/ (/var/www/html/demo) Move Files in /var/www/laravel/public folder to /var/www/html/demo

Change paths in demo/index.php

require __DIR__.'../../../laravel/bootstrap/autoload.php';
$app = require_once __DIR__.'../../../laravel/bootstrap/app.php';

Install packages with npm "laravel-mix": "^1.6.2"

Webpack.mix.js content.

let path = require('path');
mix.setPublicPath(`..${path.sep}html/demo/`);
mix.js('resources/assets/js/app.js', 'js')
	.sass('resources/assets/sass/app.scss', 'css').version();	

run npm dev

It should compile files into /var/www/html/demo folder and create mix-manifest.json file with above mentioned content.

Access example.com/demo/

It should produce the error.

Please help fix this. Thank you!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 7
  • Comments: 19

Most upvoted comments

I solved in windows with:

Install php 7 e update older path that point older version

unistall e re-install node.js (not last 9 version that seem have a bug with npm)

Fresh laravel installation 5.5

Php artisan preset react (just this by cli)

Npm install Npm run dev

Now i can compile e use react in my laravel

Even with the package being auto discovered you need still to run. php artisan vendor:publish --provider="Laravel\Horizon\HorizonServiceProvider" Then re-run yarn dev or npm run dev

By default mix() helper function use /public/manifest-json.js. When using mix.setPublicPath('new-public-path'), you need change bit thing

mix('/css/app.css', 'new-public-path')

Guk luk!

use npm run dev or npm run watch

IMO last longing option is to set path.public for whole application through provider. I found a cleaner solution here:

// app/Providers/AppServiceProvider.php

...
	public function boot()
	{
...
		$this->app->bind('path.public', function() {
			return base_path() . '/../html/demo';
		});
...
	}
...

/../html/demo part is relative to laravel directory.

You can prettify this one with some environment variable (set via .env) to make it machine-agnostic.

BTW if you can use SSH on production server, knock yourself out!

As suggested above (pfloriginale commented on Dec 8, 2017. Though I did not perform all of his steps)

  1. node.js: unistall (I had version 6) and re-install node.js (version 8, not last 9 version that seem have a bug with npm)

  2. npm install

  3. npm run dev This fixed issue for me.

Here is how I resolved this issue. i) install npm in your project area i.e (blog dir open cmd and then run npm install. ) ii) npm run dev (you 'll get even window sound of success compiled msg in console) iii) Now refresh you browser if you are getting same css and js files error then simple replace your-module name with app.css (i.e my module name was ‘test’ and that’s y my css file was test.css so replace with app.css) iv) similar for i replace .js file name with app.js file.

V) if you get still get error then you do last two steps ------ php artisan vendor:publish --provider=“Laravel\Horizon\HorizonServiceProvider” ------ npm run dev

{ Now Enjoy }

Reason: i found in my Module/Test/Resources/Assets/js/app.js (<-- now this was app.js rather than test.js Also in css) and when created Module with composer it doesn’t create module-name.css and module-name.js files.

Make sure that you are adding ‘/vendor’ in your .gitignore and not ‘vendor’. Adding just ‘vendor’ will ignore all folders named vendor in your code base