我们的应用程序在控制台中显示了这个错误。如果有人知道这件事,请帮忙。
错误——
Uncaught ReferenceError: Buffer is not defined
at varintEncode (util.js:33:1)
at ./node_modules/multicodec/src/varint-table.js (varint-table.js:11:1)
at options.factory (react refresh:6:1)
at __webpack_require__ (bootstrap:24:1)
at fn (hot module replacement:62:1)
at ./node_modules/multicodec/src/index.js (index.js:16:1)
at options.factory (react refresh:6:1)
at __webpack_require__ (bootstrap:24:1)
at fn (hot module replacement:62:1)
at ./node_modules/content-hash/src/index.js (index.js:19:1)[enter image description here][1]
我按照以下步骤成功地解决了这个问题:
-
卸载Webpack 5: npm Uninstall Webpack
-
删除package-lock.json
-
转到包。React-scripts"; "5.0.0"以"React-scripts"4.0.3",
-
install webpack 4: npm install webpack@4.44.2
-
npm安装
-
npm run start
我希望它有帮助,如果是,不要犹豫投票;)