Laravel8安装-npmrundev错误

[webpack-cli] Error: mix.react() is now a feature flag. Use mix.js(source, destination).react() instead
   at React.register (F:Serverworkreactlaravellrpc1node_moduleslaravel-mixsrccomponentsReact.js:15:19)
   at Object.components.<computed> [as react] (F:Serverworkreactlaravellrpc1node_moduleslaravel-mixsrccomponentsComponentRegistrar.js:118:53)
   at Object.<anonymous> (F:Serverworkreactlaravellrpc1webpack.mix.js:14:5)
   at Module._compile (F:Serverworkreactlaravellrpc1node_modulesv8-compile-cachev8-compile-cache.js:192:30)
   at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
   at Module.load (internal/modules/cjs/loader.js:985:32)
   at Function.Module._load (internal/modules/cjs/loader.js:878:14)
   at Module.require (internal/modules/cjs/loader.js:1025:19)
   at require (F:Serverworkreactlaravellrpc1node_modulesv8-compile-cachev8-compile-cache.js:159:20)
   at module.exports (F:Serverworkreactlaravellrpc1node_moduleslaravel-mixsetupwebpack.config.js:3:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `mix`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional >logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersinfoAppDataRoamingnpm-cache_logs2021-01-06T04_36_25_320Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! 

### This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersinfoAppDataRoamingnpm-cache_logs2021-01-06T04_36_25_340Z-debug.log

回答

要解决此问题,您需要替换此代码。

mix.react('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css');

使用 webpack.mix.js 文件中的以下代码,您可以在 Laravel 应用程序根目录中找到该文件。

mix.js('resources/js/app.js', 'public/js')
    .react()
    .sass('resources/sass/app.scss', 'public/css', [
    //
    ]);

这些更改汇总在 Laravel Mix v6 中。阅读以下内容以了解更多更改。https://github.com/JeffreyWay/laravel-mix/blob/628f6062cceb77610b1813e3179abcbd043a4642/UPGRADE.md#update-your-npm-scripts


以上是Laravel8安装-npmrundev错误的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>