1 year ago

#275594

test-img

somerandomusername

Express.js body parser throwing weird error

I'm trying to use new built in body parser in my express app.

app.use(express.urlencoded({ extended: true }))
app.use(express.json()); 

My package:

  "dependencies": {
    "canvas": "^2.9.0",
    "express": "^4.17.3",
    "gm": "^1.23.1",
    "pngjs": "^6.0.0",
    "rpi-led-matrix": "^1.11.1"
  }

And I get this error:

Error: Cannot find module '../encodings'
Require stack:
- /root/freeflow-display-adapter-v2/node_modules/iconv-lite/lib/index.js
- /root/freeflow-display-adapter-v2/node_modules/raw-body/index.js
- /root/freeflow-display-adapter-v2/node_modules/body-parser/lib/read.js
- /root/freeflow-display-adapter-v2/node_modules/body-parser/lib/types/json.js
- /root/freeflow-display-adapter-v2/node_modules/body-parser/index.js
- /root/freeflow-display-adapter-v2/node_modules/express/lib/express.js
- /root/freeflow-display-adapter-v2/node_modules/express/index.js
- /root/freeflow-display-adapter-v2/out/index.js

There really isn't such dependency in my node_modules, but even if I install "yarn add encodings" it still throws the same error.

express

body-parser

0 Answers

Your Answer

Accepted video resources