Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodemon can't read config files encoded with BOM e.g. UTF-8-BOM #1031

Closed
aresilek opened this issue May 18, 2017 · 0 comments
Closed

nodemon can't read config files encoded with BOM e.g. UTF-8-BOM #1031

aresilek opened this issue May 18, 2017 · 0 comments

Comments

@aresilek
Copy link

If you create a nodemon.json configuration file encoded with BOM such as UTF-8-BOM nodemon fails to load the configuration with the error:
SyntaxError: Unexpected token ? in JSON at position 0
at Object.parse (native)
at <%APPDATA%>\npm\node_modules\nodemon\lib\config\load.
js:180:23
at tryToString (fs.js:456:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)
[nodemon] Failed to parse config \nodemon.json

The issue seems to be that fs doesn't strip BOM characters by design and JSON.parse [correctly] chokes when it sees the BOM character as invalid JSON.

See http://stackoverflow.com/questions/24356713/node-js-readfile-error-with-utf8-encoded-file-on-windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant