Can't resolve babel-loader (webpack)

I am trying to build a page using react and webpack, using babel-loader to transpile the jsx files. When I run my build script in the terminal, webpack throws an error saying it can’t resolve babel-loader. But I know I installed it and I can see it in node_modules.

Folder structure:

root
+node_modules
+build
++config.base.js (webpack config)

As I understand it, webpack config should be looking in its own directory for node_modules. If it doesn’t find it, it should look in the next directory up (the root directory in my case). Not sure then why it’s not finding it.

Any help would be really appreciated, thanks!