Reputation: 97
I just need to revive an old project in order to modify it.
I did git checkout 0.0.2
that's the tag that is running on production right now, so I don't know why is not working.
I downloaded the code to my PC did rm -rf node_modules package-lock.json
npm install
but I'm facing this error when doing
npm run dev
or any other npm run command
/node_modules/laravel-mix/node_modules/extract-text-webpack-plugin/dist/index.js:188
chunk.sortModules();
^
TypeError: chunk.sortModules is not a function
here is my package.json
{
"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 --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.18",
"babel-preset-react": "^6.23.0",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"eslint": "^4.19.1",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.4",
"popper.js": "^1.12",
"react": "^16.2.0",
"react-dom": "^16.2.0"
},
"dependencies": {
"flickity": "^2.2.0",
"proptypes": "^1.1.0",
"react-read-more-less": "^0.1.6",
"react-spinners": "^0.5.4",
"wow.js": "^1.2.2"
}
}
I don't have any webpack.config.js file
only this webpack.mix.js
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.autoload({
jquery: ['$', 'window.jQuery', 'jQuery', 'window.$', 'jquery', 'window.jquery']
});
mix.react('resources/assets/js/app.js', 'public/js');
Node version: v8.4.0 NPM version: 5.3.0
I think i should just modify one lib but i don't know which one
Upvotes: 0
Views: 354
Reputation: 3106
I was able to recreate your issue on my local by utilizing the files you provided
Solution 1: (WORKS)
Assumes you want to stay on same version of lavarel-mix
to avoid any build errors with production
Lock your lavaler-mix version in package.json. Note how i removed the caret (^). You can then just do rm -rf node_modules package-lock.json; npm install
after making the below edit in your package.json file.
"laravel-mix": "2.0"
Solution 2 (DOESN'T WORK):
Assumes you don't care about your lavarel version compatibility.
Install latest version that you feel comfortable with
npm install laravel-mix@latest -D
This one gets following error when tested with your sample files above
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
NOTE: Solution 2 could work but you will need to most likely update your webpack.mix.js config to make it work.
Upvotes: 1
Reputation: 4684
Your "laravel-mix"
version is very low.
Try to install the latest version to see if it fix your problem.
npm install laravel-mix@latest -D
Upvotes: 0