Grunt Serve watch throws EBUSY warning over mongod

2019-09-14 08:20发布

问题:

I have an app I am building using the full stack angular yeoman generator. I start mongod passing the path to my data folder:

[my local path]/[my new app name]/server/data

In my app i then run the grunt serve task. The app boots up correctly however the watch task throws a warning and then fails to do any live reloads it also causes the app in the browser to continuously load.

The warning I get it:

EBUSY, resource busy or locked "[my local path]/[my new app name]/server/data/mongod.lock"

Not sure what is going on everything I have read about this suggests that I have multiple instances open trying to access the DB but I am pretty sure I do not.

L

回答1:

So after typing the above question I realised what I did wrong pretty quickly.

MAKE SURE YOUR DATA FOLDER IS NOT BEING WATCHED BY GRUNT

I had my data folder within the server folder created by the yeoman project which was being watched by grunt but also locked by mongod. I moved my data folder (I am sure you could ignore the data directory instead) and it now works well.

I hope this saves someone else the 20 mins it took me to figure it out :)

L