javascript - 使用“npm start”运行 JHipster 生成的前端时出现“未知选项”错误
问题描述
每当我运行我的默认 JHipster 项目时(我只更改了后端的一些代码并进行了一些样式更改),我都会收到以下错误:
[webpack-cli] 错误:未知选项 '--inline' [webpack-cli] 运行 'webpack --help' 以查看可用的命令和选项
已经运行sudo npm i -S webpack@latest以确保我使用的是新的 webpack 版本。
如果我从命令中删除--inline,我会得到一个不同的错误:
1% setup initialize[webpack-cli] 无效的选项对象。开发服务器已使用与 API 架构不匹配的选项对象进行初始化。options 具有未知属性“watchOptions”。这些属性有效:object { allowedHosts?、bonjour?、client?、compress?、devMiddleware?、headers?、historyApiFallback?、host?、hot?、http2?、https?、ipc?、liveReload?、magicHtml?、onAfterSetupMiddleware ?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, setupExitSignals?, static?, watchFiles?, webSocketServer? }
这里有点困惑,因为我还没有设置项目,也有一段时间没有接触过 webpack - 感谢任何帮助并提前感谢!
解决方案
It was simply a version dependency mismatch. For some reason, the Webpack Config was not defined for the same version as the as the one installed (v4 vs v5 respectively) - I simply assumed that the package json settings would prevent this from happening. I went through each error using the webpack docs and upgraded it according to the migration instructions.
推荐阅读
- reactjs - 无法使用 axios put 上传大于 10mb 的有效载荷
- ansible - 瞻博网络 ansible 模块在 ansible 2.10 上失败
- azure - 使用授权代码流从 Azure AD 请求 Oauth2 令牌时访问被拒绝
- python-3.x - 在按 id 分组的排序数据框中获取第一个值
- vue-i18n - vue i18n Interpolation how to inject variables
- javascript - 在 iframe 中获取正文的背景颜色
- python - How to change a wallpaper to slideshow in Windows using Python or Batch?
- typescript - 如何去除vscode中的红色下划线错误?(打字稿)
- python - 使用 djangocms 发布页面更改时出现“NodeAlreadySaved”错误
- flutter - how to Make whole page scrollable instead to GridView Builder in flutter?