Strange behavior in MacOS
See original GitHub issueI have used this http server for years and never had any issues at all. All the sudden I went to install http-server on my new mac and I am unable to host a simple static HTML file. I am able to install the http-server package using NPM but then when I try to host a web server I see this strange behavior in terminal:
Environment Versions
- MacOS Monterey: 12.1
- Node version: 16.13.1
- NPM version: 8.1.2
- http-server version: 14.0.0
Steps to reproduce
npm i http-server
npx http-server
Expected result
The web server gets hosted and the Terminal window shows network log info as usual
Actual result
The web server is not hosted and instead the terminal window spams endless unrecognizable characters as seen in the screenshot
Other information
I have tried using multiple different versions of the http-server package including versions 13.0.0 and much older versions but the behavior is the same. I tried using sudo
when installing the http-server package but that did not change anything. I also tried giving my Terminal Full Disk Access and access to the Developer Tools but nothing I have tried changes the behavior.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top GitHub Comments
This issue is due to the NPM module “colors”, it’s author went rogue and added an infinite for loop because he thought it would be funny, can be solved by pinning to version 1.4.0
https://github.com/http-party/http-server/blob/72b6b07177cb1ebdd9a74ffd6ec50cd0171a14be/package.json#L89
This is fixed in http-server v14.1.0 and backported to v13.1.0. It was indeed caused by Marak/colors.js#285, and we fixed it by switching out
colors.js
forchalk
.