如何修改 npm-debug.log 路径,无解

目前没有找到修改 npm-debug.log 路径的方法,除非修改源码。

npm 版本是 3.3.12

这是 2014 年 stackoverflow 上的提问 Change npm-debug.log location,以及在 github 上讨论的 issue
Put npm-debug.log file in the cache folder, not cwd #6744
npm-debug.log could be written to /tmp or similar #1548
以及假想解决方案
Make npm-debug.log path configurable. #5252
将 log 文件写入 app 目录的风险显而易见,尤其正式环境一般都不会开放 app 目录写权限。

在源文件 npm/lib/util/error-handler.js 中 writeLogFile() 内部已经 hardcode writeStream(‘npm-debug.log’),当初是如何构思的?

紧接着想到是否可以禁用 node-debug.log, 不过这并不是一个很好的解决方案.

 

npm 命令行参考 官方 Shorthands and Other CLI Niceties

 

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注