inf3rno
inf3rno

Reputation: 26137

How to avoid `npm-debug.log` creation

I run my testing script with npm run test and added {script: {test: "jasmine"}} to the package.json. My problem that every time I run the test, npm generates an npm-debug.log file, which I don't need. Is there a way to turn off this feature?

note:

I will use npm run only by running the tests on http://travis-ci.org/ if it is not possible to turn off this feature, will it generate a log file on the travis server by testing the build, or what?

news 2016:

There are news in the topic. At least after 5 years npm debug log was moved to the cache folder: https://github.com/npm/npm/issues/1548 , so it no longer pollutes our project folders.

Upvotes: 18

Views: 20803

Answers (2)

m59
m59

Reputation: 43785

Sort of good news, eveyone! You can suppress them by setting a command line parameter -loglevel silent, like npm install sfdfsdf -loglevel silent. However, this will also turn off feedback in the console, so I wouldn't do that.

I recommend ignoring them in your .gitignore file, so that they aren't officially in your project. Then, I just pretend they aren't there bothering my obsessive mind. =D

npm config docs. GitHub discussion about this issue.

Upvotes: 9

Florian Wendelborn
Florian Wendelborn

Reputation: 1747

In addition to m59's answer, you could modify your npm run test to include && rm npm-debug.log. This will automatically delete the log after the test is finished, basically never letting you see it.

Upvotes: 5

Related Questions