问题
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