我正在尝试从Webpack v1升级到v3 --我一直在跟踪官方迁移文档中的所有内容,但是在运行node client/scripts/start.js时,我仍然会遇到这些错误。我不知道如何修复它们:
Starting dev server on port 3000...
Failed to compile.
Error in ./node_modules/react-dev-utils/webpackHotDevClient.js
Module not found: Can't resolve 'ansi-html' in '/Users/me/work/-admin/node_modules/react-dev-utils'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Module not found: Can't resolve 'babel' in '/Users/me/work/-admin'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in ./client/config/polyfills.js
Module not found: Can't resolve 'bluebird' in '/Users/me/work/-admin/client/config'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in ./client/config/polyfills.js
Module not found: Can't resolve 'core-js/actual' in '/Users/me/work/-admin/client/config'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in ./node_modules/react-dev-utils/webpackHotDevClient.js
Module not found: Can't resolve 'html-entities' in '/Users/me/work/-admin/node_modules/react-dev-utils'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in ./client/config/polyfills.js
Module not found: Can't resolve 'object-assign' in '/Users/me/work/-admin/client/config'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Module not found: Can't resolve 'react-hot-loader/patch' in '/Users/me/work/-admin'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in ./client/config/polyfills.js
Module not found: Can't resolve 'regenerator-runtime/runtime' in '/Users/me/work/-admin/client/config'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in ./node_modules/react-dev-utils/webpackHotDevClient.js
Module not found: Can't resolve 'sockjs-client' in '/Users/me/work/-admin/node_modules/react-dev-utils'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in ./node_modules/react-dev-utils/webpackHotDevClient.js
Module not found: Can't resolve 'strip-ansi' in '/Users/me/work/-admin/node_modules/react-dev-utils'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js
Error in ./client/config/polyfills.js
Module not found: Can't resolve 'whatwg-fetch' in '/Users/me/work/-admin/client/config'
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./client/config/polyfills.js react-hot-loader/patch ./client/src/index.js不过,我有这么多人。这些文件确实存在。
有人有什么想法吗?
发布于 2022-06-30 21:33:35
您缺少依赖项或它们的坏版本
如果是节点模块中的错误,这意味着您的版本与webpack版本不兼容。这里说的是react-dev-utils和webpack玩得不好
Error in ./node_modules/react-dev-utils/webpackHotDevClient.js如果错误在项目中的一个文件中,那么您将丢失依赖项并需要安装它。
Error in ./client/config/polyfills.js
Module not found: Can't resolve 'whatwg-fetch'安装它
npm i --save whatwg-fetchhttps://stackoverflow.com/questions/72822193
复制相似问题