Any ideas?
Laravel Mix failures - possible dependency issue
I'm trying to manage my dependencies using Laravel Mix. Installing my dependencies works fine, however running npm run dev brings me to a world of trouble.
Here is my package.json file:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.16.2",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.0.1",
"eonasdan-bootstrap-datetimepicker": "^4.17.0",
"modernizr": "^3.3.1",
"restfulizerjs": "^1.0.0",
"jquery": "^3.1.1",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.1.10"
}
}
Here is my Laravel mix file:
let mix = require('laravel-mix');
var paths = {
'bootstrap': './node_modules/bootstrap-sass/assets/',
'dateTimePicker': './node_modules/eonasdan-bootstrap-datetimepicker/src/',
'jquery': './node_modules/jquery/',
'modernizr': './node_modules/modernizr/',
'moment': './node_modules/moment/',
'momentTimezone': './node_modules/moment-timezone/',
'restfulizer': './node_modules/restfulizerjs/'
};
mix
// Compile SASS files
.sass('resources/assets/bootstrap/sass/app.scss', 'public/bootstrap/css/app.css')
// Copy fonts to public directory
.copy(paths.bootstrap + 'fonts/bootstrap/**', 'public/bootstrap/fonts')
// Combine Javascript files
.js([
paths.jquery + "dist/jquery.js",
paths.bootstrap + "javascripts/bootstrap.js",
paths.moment + "moment.js",
paths.dateTimePicker + "js/bootstrap-datetimepicker.js",
paths.restfulizer + "jquery.restfulizer.js",
"resources/assets/bootstrap/js/app.js"
], 'public/bootstrap/js/app.js', './')
// Version stylesheet and javascript file
.version();
The error that I get is the following:
$ npm run dev
> @ dev /var/www/my-hiddit/htdocs
> npm run development
> @ development /var/www/my-hiddit/htdocs
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.output.path: The provided value "public" is not an absolute path!
That brought me to these posts on the Laravel Mix github page. At first, it didn't seem to apply to me because I have Laravel mix at ^1.0 in my package.json file. But then I ran a node list --depth=0 and got the following:
$ npm list --depth=0
/var/www/my-hiddit/htdocs
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
I've tried to fix this in any number of ways, but no matter what I do Laravel Mix always stays stuck at 0.7.5 - even if I fix the version or if I remove all other dependencies from the file. I assume this is what's causing my other problem but I have absolutely no idea why this is happening or how I can fix it.
Any help would be appreciated.
- OS: Ubuntu 16
- Ruby version: 2.3.1
- Node version: 8.0.7
- NPM version: 5.0.3
- I am NOT using a custom webpack config file
It seems NodeJs was the problem here. I recently updated to Node 8.4.* and all my problems disappeared
Please or to participate in this conversation.