Angulr npm start 报错:throw new TypeError('The header content contains invalid characters');

报错信息:

> [email protected] start D:\workspace\Angulr

> node node_modules/http-server/bin/http-server -o


Starting up http-server, serving ./ on port: 8081
Hit CTRL-C to stop the server
[Mon, 11 Jun 2018 02:34:08 GMT] "GET /" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
_http_outgoing.js:498
    throw new TypeError('The header content contains invalid characters');
    ^


TypeError: The header content contains invalid characters
    at validateHeader (_http_outgoing.js:498:11)
    at ServerResponse.setHeader (_http_outgoing.js:502:3)
    at module.exports.ResponseStream.(anonymous function) [as setHeader] (D:\workspace\Angulr\node_modules\union\lib\response-stream.js:86:34)
    at D:\workspace\Angulr\node_modules\ecstatic\lib\ecstatic\showdir.js:42:13
    at FSReqWrap.oncomplete (fs.js:137:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node node_modules/http-server/bin/http-server -o`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-06-11T02_34_08_404Z-debug.log        

报错原因:该版本http-server有bug

解决办法:

把package.json文件中第30行"http-server": "^0.6.1",改为"http-server": "^0.9.0",

执行更新命令:npm update http-server

重新启动:npm start

Angulr npm start 报错:throw new TypeError('The header content contains invalid characters');_第1张图片

你可能感兴趣的:(Angulr npm start 报错:throw new TypeError('The header content contains invalid characters');)