正如标题所说,当从5.5开始使用Laravel / Laravel混音时,如何在我的反应前端添加redux?
<小时/> 到目前为止,我尝试了以下内容。
npm install --save redux
npm install --save react-redux
然后,在运行npm run dev
时,我收到以下错误,我无法将其编码为任何有用的内容......
> @ dev /home/anders/Code/project
> npm run development
> @ development /home/anders/Code/project
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
events.js:182
throw er; // Unhandled 'error' event
^
Error: spawn node_modules/webpack/bin/webpack.js ENOENT
at exports._errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
at onErrorNT (internal/child_process.js:374:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:607:11)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! Exit status 1
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! /home/anders/.npm/_logs/2017-12-21T13_57_49_940Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: "npm run development"
npm ERR! Exit status 1
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! /home/anders/.npm/_logs/2017-12-21T13_57_50_015Z-debug.log
我确实通过克隆此repo来获得并运行样板非laravel-mix react / redux应用程序:https://github.com/buckyroberts/React-Redux-Boilerplate。看看那个项目package.json我试图模仿它但是无法构建如上所示。
我在Ubuntu上运行。
答案 0 :(得分:0)
我最终手动将其版本添加到我的composer.json:
"react-redux": "^4.4.5",
"redux": "^3.5.2"
在发布这篇文章时,它已经过时了,但它让我跑了。
我将一个纯粹的react / redux应用程序复制到Laravel中以获得一些样板。如果有人对此感兴趣,请将其转移到此处:https://github.com/ajthinking/laravel-react-redux/tree/master