Why can't webpack find any module from my React Webapp?

不打扰是莪最后的温柔 提交于 2019-12-11 21:16:18

问题


I want to run webpack on ubuntu to run my react webapp. When running webpack from the command line, I get the following error (just a small extraction of all the errors that I get):

ERROR in Cannot find module 'loader-utils' @ ./src/components/WaitingMsg.styl 4:14-129 13:2-17:4 14:20-135

ERROR in Cannot find module 'loader-utils' @ ./src/components/CreateBox.styl 4:14-128 13:2-17:4 14:20-134

ERROR in Cannot find module 'loader-utils' @ ./src/components/Trashbin.styl 4:14-127 13:2-17:4 14:20-133

...

ERROR in ./src/components/Minimap.jsx Module not found: Error: Cannot resolve 'file' or 'directory' ./minimap.styl in /var/www/WebApp/webapp_client/src/components @ ./src/components/Minimap.jsx 23:0-25

ERROR in Cannot find module 'loader-utils' @ ./src/components/IdeaNode.styl 4:14-127 13:2-17:4 14:20-133

ERROR in ./~/react-dnd/lib/DragLayer.js Module not found: Error: Cannot resolve module 'invariant' in /var/www/WebApp/webapp_client/node_modules/react-dnd/lib @ ./~/react-dnd/lib/DragLayer.js 35:17-37 ...

ERROR in ./~/socket.io-client/lib/manager.js Module not found: Error: Cannot resolve module 'backo2' in /var/www/WebApp/webapp_client/node_modules/socket.io-client/lib @ ./~/socket.io-client/lib/manager.js 16:14-31

...

ERROR in ./~/react-dnd/lib/bindConnectorMethod.js Module not found: Error: Cannot resolve module 'disposables' in /var/www/WebApp/webapp_client/node_modules/react-dnd/lib @ ./~/react-dnd/lib/bindConnectorMethod.js 16:19-41

ERROR in ./~/react-dnd/lib/utils/cloneWithRef.js Module not found: Error: Cannot resolve module 'invariant' in /var/www/WebApp/webapp_client/node_modules/react-dnd/lib/utils @ ./~/react-dnd/lib/utils/cloneWithRef.js 8:17-37

I run this on Ubuntu 14.04. What am I doing wrong here? Am I missing any packages?


回答1:


I expect you need to install loader-utils into you project. You can do this with the following command.

npm i loader-utils --save-dev

More info on the package can be found here:

https://www.npmjs.com/package/loader-utils




回答2:


It is pointed out that you do not have a module called 'loader-utils'.If you want any help, I'd like to see your configuration of your webpack. I can't help you without more information.



来源:https://stackoverflow.com/questions/35425595/why-cant-webpack-find-any-module-from-my-react-webapp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!