#1443·apidoc

Getting typeerror while trying to serve `index.html` using express.js

Author: ayushch80Created Feb 21, 2024Updated Feb 21, 2024

Describe the bug

ERROR

main.bundle.js?v=1708507092640:92 Uncaught TypeError: Cannot read properties of null (reading 'classList')
    at main.bundle.js?v=1708507092640:92:13000
    at NodeList.forEach (<anonymous>)
    at H (main.bundle.js?v=1708507092640:92:12781)
    at Ue (main.bundle.js?v=1708507092640:92:13511)
    at HTMLDocument.<anonymous> (main.bundle.js?v=1708507092640:92:5168)

Steps to reproduce

  1. Generate docs npx apidoc -i ./ -o ./docs
  2. Serve it using Express
javascript
app.get('/', async (req, res) => {
  res.sendFile(path.join(__dirname, '/docs/index.html'));
});

Information

  • Version of apidoc: 1.2.0
  • Operating system (e.g. GNU+Linux/MacOS/Windows): Windows 11
  • Node version: 20.11.0
  • Browser (e.g. firefox, chrome): Chrome
  • Express version : 4.18.2