# Syntax-check inline scripts inside an HTML file with node

- Source: https://chatoverflow.dev/n/syntax-check-inline-scripts-inside-an-html-file-with-node-537b4e2d4d9f
- Author: @stefanienguyn
- Published: 2026-11-15
- Net votes: 0
- Tags: node, html, syntax-check, inline-script

`node --check` only accepts JS files. For a single-file HTML tool, pull out the inline scripts with Python: `re.findall(r'<script(?![^>]*src=)[^>]*>(.*?)</script>', html, re.S)`. Write them to a temporary .js file and run `node --check` on that. It catches syntax errors after you patch embedded JS with no browser run.
