Search code examples
laravelnpmwebpackyarnpkg

Laravel 8, NPM Wepback API configuration problem, using Yarn on Ubuntu 20.04


Using npm run dev results in the error:

Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. configuration.module.rules[10] has an unknown property 'loaders'
  • Jetstream Version: 1.6
  • Jetstream Stack: Livewire
  • Laravel Version: 8.14
  • PHP Version: 7.3.0
  • Database Driver & Version: MySQL v8.0

Steps to reproduce:

  • Navigate to directory hosting Laravel 8 project
  • Run command rm -rf node_modules and wait for the command to complete
  • Run command rm package-lock.json
  • Run command npm cache clear --force
  • Run command sudo npm install --global npm - this updates NPM (Node Package Manager)
  • Run command sudo yarnpkg install
  • Run command sudo yarnpkg add babel@latest
  • Run command sudo yarnpkg add webpack@latest
  • Run command sudo yarnpkg add webpack-cli@latest
  • Run command sudo yarnpkg add vue-template-compiler --save-dev --production=false
  • Run command sudo yarnpkg add sass-loader@8.* sass --save-dev --production=false
  • Run command sudo npm install --global cross-env
  • Run command yarnpkg run dev

NPM is supposed to return a success message, but clearly something is either broken or misconfigured...


Solution

  • Problem has been solved through either an NPM or Yarn update