【发布时间】:2020-10-16 12:55:52
【问题描述】:
我正在做 React 项目。它工作正常。但是现在每当我启动 npm 时。它给了我错误:
$ react-scripts start
i 「wds」: Project is running at http://192.168.18.45/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\xampp\htdocs\SkyHi\Staah\staah-instant-site\public
i 「wds」: 404s will fallback to /
Starting the development server...
Failed to compile.
./node_modules/@fortawesome/fontawesome-svg-core/index.es.js
Error: [BABEL] C:\xampp\htdocs\SkyHi\Staah\staah-instant-site\node_modules\@fortawesome\fontawesome-svg-core\index.es.js: Could not find plugin "proposal-class-properties". Ensure there is an entry in ./available-plugins.js for it. (While processing: "C:\\xampp\\htdocs\\SkyHi\\Staah\\staah-instant-site\\node_modules\\babel-preset-react-app\\dependencies.js$0")
at Array.map (<anonymous>)
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
我正在使用yarn。
我该如何解决这个错误?
【问题讨论】:
-
你的 package.json 是否包含 @babel/plugin-proposal-class-properties?
-
是的。它在那里。为临时。我已经卸载了 node_module 目录并重新安装它。但我认为这不是解决此问题的正确方法。他们可能是解决这个问题的正确方法。希望这篇文章能帮助人们花时间寻找解决方案。希望有人能正确回答。
-
同样的问题,尝试了一切,但没有解决方案。 (即使删除 node_module 也没有解决问题)