找不到Webpack模块:错误:无法解析模块

世人

我从webpack中收到一些模块未找到的错误,但问题是文件实际上在那里。我已进行了三重检查,并确定文件在那里,但是由于某些原因,webpack无法找到它们。我有什么办法找出有关webpack为何失败的更多信息?

ERROR in ./~/react-router/BrowserRouter.js
Module not found: Error: Cannot resolve module 'history/createBrowserHistory' in [MODULE_PROJECT_ROOT]\node_modules\react-router
 @ ./~/react-router/BrowserRouter.js 11:28-67

ERROR in ./~/react-router/HashRouter.js
Module not found: Error: Cannot resolve module 'history/createHashHistory' in [MODULE_PROJECT_ROOT]\node_modules\react-router
 @ ./~/react-router/HashRouter.js 11:25-61

ERROR in ./~/react-router/HashRouter.js
Module not found: Error: Cannot resolve module 'history/PathUtils' in [MODULE_PROJECT_ROOT]\node_modules\react-router
 @ ./~/react-router/HashRouter.js 19:17-45

ERROR in ./~/react-router/MemoryRouter.js
Module not found: Error: Cannot resolve module 'history/createMemoryHistory' in [MODULE_PROJECT_ROOT]\node_modules\react-router
 @ ./~/react-router/MemoryRouter.js 11:27-65

ERROR in ./~/react-router/LocationUtils.js
Module not found: Error: Cannot resolve module 'history/PathUtils' in [MODULE_PROJECT_ROOT]\node_modules\react-router
 @ ./~/react-router/LocationUtils.js 17:17-45

ERROR in ./~/react-router/LocationUtils.js
Module not found: Error: Cannot resolve module 'history/LocationUtils' in [MODULE_PROJECT_ROOT]\node_modules\react-router
 @ ./~/react-router/LocationUtils.js 8:21-53

ERROR in ./~/react/lib/CSSPropertyOperations.js
Module not found: Error: Cannot resolve module 'fbjs/lib/memoizeStringOnly' in [MODULE_PROJECT_ROOT]\node_modules\react\lib
 @ ./~/react/lib/CSSPropertyOperations.js 21:24-61
世人

我发现了为什么webpack找不到所需的模块。我已经提供的,以绝对路径的数组resolve.modulesDirectoriesresolveLoader.modulesDirectories我忘记要做的是在数组中包括这些字段的默认值。就我而言,我只是将“ node_modules”放在文件路径的这些数组中,这解决了我的问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

找不到模块:错误:无法解析模块

找不到模块:错误:无法解析模块

webpack找不到模块:错误:无法解析“ jquery”

找不到 webpack 模块:错误:无法解析类名

Webpack解析模块路径。找不到模块:错误:无法解析“ ./internal/Observable”

找不到模块:错误:无法解析“ hammerjs”

找不到模块:错误:无法解析“ ./templates”

找不到模块:错误:无法解析“ fs”

找不到模块:错误:无法解析“ReactDOM”

找不到模块:错误:无法解析“ dropzone”

找不到模块:错误:使用webpack时无法解析模块“反应”

找不到模块:错误:无法解析模块“组件/应用程序”。webpack + reactjs问题

找不到模块:错误:无法解析模块“服务器”

“找不到模块:错误:无法解析模块'react / lib / ReactMount'”

找不到模块:错误:无法解析模块'***。jpg'

找不到模块:错误:无法解析模块“ fs”

Webpack:移动Webpack的位置/反应文件后,启动npm start“找不到模块:错误:无法解析...”

webpack:在入口模块中找不到错误:错误:无法解析“文件”或“目录” .jsx

Webpack 4:在入口模块中找不到错误:错误:无法解析“ ./src”

Webpack 4:在入口模块中找不到错误:错误:无法解析“ ./src”

找不到模块:无法解析

Webpack升级-找不到模块:无法解析node_modules

找不到模块:错误:无法解析“文件”或“目录”(在Webpack中导入sass)

webpack:找不到模块:错误:无法解析(带有相对路径)

webpack-找不到模块:错误:无法解析“ ./src/app/app.component.html”

Webpack - 找不到模块:错误:无法解析“node_modules\chokidar\lib”

[React Webpack]:找不到模块:错误:无法解析“ C:\ Users \ ....”中的“ src / views / UserList”

错误:找不到模块:错误:无法解析“ @ angular / cdk / scrolling”

MUI:找不到模块“找不到模块:错误:无法解析'时刻'”