Paulos3000
Paulos3000

Reputation: 3545

Bower package not found - necessary to use npm as well?

I'm new to Bower, and I'm setting up a dummy project. I have initialised my project and installed jQuery and gulp just to get things started. This is fine, they have been added to my dependencies list in bower.json and are now present in my bower_modules folder. Great so far.

However, I want to install two plugins: main-bower-files and gulp-filter, but bower doesn't seem to have these libs.

When I run bower install --save main-bower-files, I get:

bower ENOTFOUND Package main-bower-files not found

So, it seems my only solution is use npm instead. But surely bower is supposed to be an alternative to npm, right?

Or is the only solution just to npm init as well as bower init at the start of the project, and then run two lists of separate dependencies?

Any help appreciated.

Upvotes: 1

Views: 638

Answers (1)

gandreadis
gandreadis

Reputation: 3242

Actually, Bower and NPM have slightly different aims.

In my experience, Bower focuses mainly on frontend packages (jQuery, CreateJS, ...). See it as an alternative of using an external CDN for certain resources. NPM, however, has most of those packages on Bower, and then a large selection of packages for the backend, as well.

You would indeed need to keep two separate dependency lists, if you need packages from both repositories. Using those two managers in tandem is actually not that uncommon.

Be sure to install gulp and its modules through NPM, since they are definitely not frontend resources.

TLDR: Bower = frontend resources that you could have also hosted on a CDN, NPM = everything from frontend to backend and more.

Upvotes: 1

Related Questions