Laravel 8,NPM Wepback API 配置问题,在 Ubuntu 20.04 上使用 Yarn
Laravel 8, NPM Wepback API configuration problem, using Yarn on Ubuntu 20.04
使用 npm run dev
导致错误:
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 版本:1.6
- Jetstream Stack:Livewire
- Laravel版本:8.14
- PHP版本:7.3.0
- 数据库驱动程序和版本:MySQL v8.0
重现步骤:
- 导航到目录托管 Laravel 8 项目
- 运行命令
rm -rf node_modules
并等待命令完成
- 运行命令
rm package-lock.json
- 运行命令
npm cache clear --force
- 运行 命令
sudo npm install --global npm
- 这会更新 NPM(节点包管理器)
- 运行命令
sudo yarnpkg install
- 运行命令
sudo yarnpkg add babel@latest
- 运行命令
sudo yarnpkg add webpack@latest
- 运行命令
sudo yarnpkg add webpack-cli@latest
- 运行命令
sudo yarnpkg add vue-template-compiler --save-dev --production=false
- 运行命令
sudo yarnpkg add sass-loader@8.* sass --save-dev --production=false
- 运行命令
sudo npm install --global cross-env
- 运行命令
yarnpkg run dev
NPM 应该 return 一条成功消息,但显然有些东西损坏或配置错误...
问题已通过 NPM 或 Yarn 更新解决
使用 npm run dev
导致错误:
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 版本:1.6
- Jetstream Stack:Livewire
- Laravel版本:8.14
- PHP版本:7.3.0
- 数据库驱动程序和版本:MySQL v8.0
重现步骤:
- 导航到目录托管 Laravel 8 项目
- 运行命令
rm -rf node_modules
并等待命令完成 - 运行命令
rm package-lock.json
- 运行命令
npm cache clear --force
- 运行 命令
sudo npm install --global npm
- 这会更新 NPM(节点包管理器) - 运行命令
sudo yarnpkg install
- 运行命令
sudo yarnpkg add babel@latest
- 运行命令
sudo yarnpkg add webpack@latest
- 运行命令
sudo yarnpkg add webpack-cli@latest
- 运行命令
sudo yarnpkg add vue-template-compiler --save-dev --production=false
- 运行命令
sudo yarnpkg add sass-loader@8.* sass --save-dev --production=false
- 运行命令
sudo npm install --global cross-env
- 运行命令
yarnpkg run dev
NPM 应该 return 一条成功消息,但显然有些东西损坏或配置错误...
问题已通过 NPM 或 Yarn 更新解决