简体   繁体   中英

Uncaught ReferenceError: Buffer is not defined at varintEncode (util.js:33:1) - due do this my application is crashing

Our application is showing this error in the console. Please help if anybody knows about it.

Error-

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]

I succeed to solve the problem by following those steps:

  1. Uninstall Webpack 5: npm uninstall webpack

  2. delete package-lock.json

  3. Go to package.json and change from "React-scripts": "5.0.0" to "React-scripts": "4.0.3",

  4. install webpack 4: npm install webpack@4.44.2

  5. npm install

  6. npm run start

I hope it helps, if yes don't hesitate to upvote;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM