为什么 webpack 无法从我的 React Webapp 中找到任何模块? [英] Why can't webpack find any module from my React Webapp?
问题描述
我想在 ubuntu 上运行 webpack 来运行我的 react webapp.当从命令行运行 webpack 时,我收到以下错误(只是我得到的所有错误的一小部分提取):
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):
找不到模块 '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/WaitingMsg.styl 4:14-129 13:2-17:4 14:20-135
找不到模块 '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/CreateBox.styl 4:14-128 13:2-17:4 14:20-134
找不到模块 'loader-utils' @ 中的错误./src/components/Trashbin.styl 4:14-127 13:2-17:4 14:20-133
ERROR in Cannot find module 'loader-utils' @ ./src/components/Trashbin.styl 4:14-127 13:2-17:4 14:20-133
...
./src/components/Minimap.jsx 模块中的错误未找到:错误:无法解析 'file' 或 'directory' ./minimap.styl in/var/www/WebApp/webapp_client/src/components @./src/components/Minimap.jsx 23:0-25
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
找不到模块 'loader-utils' @ 中的错误./src/components/IdeaNode.styl 4:14-127 13:2-17:4 14:20-133
ERROR in Cannot find module 'loader-utils' @ ./src/components/IdeaNode.styl 4:14-127 13:2-17:4 14:20-133
./~/react-dnd/lib/DragLayer.js 模块中的错误未找到:错误:无法解析模块不变"/var/www/WebApp/webapp_client/node_modules/react-dnd/lib @./~/react-dnd/lib/DragLayer.js 35:17-37...
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 ...
./~/socket.io-client/lib/manager.js 模块中的错误未找到:错误:无法解析模块backo2"/var/www/WebApp/webapp_client/node_modules/socket.io-client/lib @./~/socket.io-client/lib/manager.js 16:14-31
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
...
./~/react-dnd/lib/bindConnectorMethod.js 模块中的错误未找到:错误:无法解析模块一次性"/var/www/WebApp/webapp_client/node_modules/react-dnd/lib @./~/react-dnd/lib/bindConnectorMethod.js 16:19-41
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
未找到 ./~/react-dnd/lib/utils/cloneWithRef.js 模块中的错误:错误:无法解析模块不变"/var/www/WebApp/webapp_client/node_modules/react-dnd/lib/utils @./~/react-dnd/lib/utils/cloneWithRef.js 8:17-37
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
我在 Ubuntu 14.04 上运行它.我在这里做错了什么?我是否缺少任何包裹?
I run this on Ubuntu 14.04. What am I doing wrong here? Am I missing any packages?
推荐答案
我希望您需要将 loader-utils 安装到您的项目中.您可以使用以下命令执行此操作.
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
这篇关于为什么 webpack 无法从我的 React Webapp 中找到任何模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!