Mongoose NPM package is HUGE and contains logs

2019-09-16 14:27发布

问题:

I'm using mongoose to connect to a mongo database.

I'd like to understand why node_modules/mongoose goes over 1gb... And when I check what's inside, I get 3 huge folders (31000, 31001, 31002) with what seems to be logs, even with a fresh reinstall..

$ rm -Rf node_modules/mongoose
$ npm i mongoose
$ ls -al node_modules/mongoose/tools/31000/journal
total 614400
drwxr-xr-x   5 florian  staff        170 May 28 08:48 .
drwxr-xr-x  27 florian  staff        918 May 28 08:48 ..
-rw-r--r--   1 florian  staff  104857600 May 24 21:27 WiredTigerLog.0000000001
-rw-r--r--   1 florian  staff  104857600 May 24 08:06 WiredTigerPreplog.0000000001
-rw-r--r--   1 florian  staff  104857600 May 24 08:06 WiredTigerPreplog.0000000002

What is it ? How do I get rid of it ?

回答1:

It looks like mongoose@4.10.3 was published to the NPM repository containing those database files (which of course shouldn't have happened).

I've contacted the author, but for now, you can use the previous version:

npm i mongoose@4.10.2


回答2:

mongoose@4.10.4 is already out and doesn't have 900mb of bonuses



回答3:

Try to install the latest version of Mongoose. For that clear NPM cache on your local machine:

npm remove mongoose
npm cache clean
npm install mongoose