Why people use bower and npm to inject any library into project - npm

suppose i am working with asp.net mvc with VS2013 IDE. we can download angular-ui-router js file from any web site and copy that file in script folder of my project and refer those js file in web pages.
so my question is why i should use bower or npm to download js files like below example. please tell me extra advantage of using bower or npm to download js files ?
bower install
$ bower install angular-ui-router
npm install
$ npm install angular-ui-router
thanks

If the library evolves/updates or if the project is moved, those package managers allows to keep up to date with all the needed plugins, without having to look for each one, download the last/needed version of each one, and moving them where you need.
You don't need to use them if you don't need them. As any tool, they are there if you need them.

Related

Where to install bulma-start through npm in project

I have created a css folder in my public folder of my project. Is it handy to npm install bulma-start directly in the css folder? Currently project links to Bulma via CDN link but I want to install it on my local machine so the project can run it locally. Can you please recommend the best procedures for installing all dependancies correctly?
Using bulma-start is bit different as compared to working with other npm packages so here are the steps I've followed to work with bulma-start.
Create another folder say temp.
Initiate npm package there by using npm init
Install bulma-start by using npm install bulma-start.
Copy paste all the files inside the node-modules to wherever you want to work with this project.
Again do npm install to install the dependencies of bulma-start i.e. bulma etc.
Feel free to delete temp.
Is it handy to npm install bulma-start directly in the css folder?
bulma-start is a complete package to start working, this includes the whole js, sass, CSS folders and scripts to start working. So bulma-start should be considered as the parent folder of your project.

Install third party js library mess up existing node_modules in jhipster project

Currently I need to add third party (ng2-charts) js library to my jhipster project, open cmd window, and navigate to the application root directory, and:
npm install --save chart.js
npm install --save ng2-charts.js
After installation, I found the application is broken, some existing modules disappear, like #angular/core!
I suspect something wrong, what should be the correct way to install third party library?

How do I use videojs playlist?

How do I install the video js playlist plug-in? In the example they ask for this file: path/to/videojs-playlist/dist/videojs-playlist.js, but I don't find a dist folder or the .js file. Clues? I have the video.js file. Thanks!
https://github.com/brightcove/videojs-playlist
Installing NodeJS
Multiple installers are available on their download page.
https://docs.npmjs.com/getting-started/installing-node
Using Npm install
This command installs a package, and any packages that it depends on. It reads the file package.json and installs what ever dependency it requires.
It should install all the files you require to run videojs-playlist
After installing simply execute the following command in your videojs-playlist project folder.
npm install videojs-playlist

Why do NPM node modules contain a bower.json file?

I've been tasked with removing bower where possible and instead using NPM to install modules. I've done a search of the codebase and the only bower.json files are within NPM node modules. I thought that NPM was an alternative to bower, is this incorrect?
I was expecting to find a bower.json file in the project root. As I haven't does it should like NPM is already being used instead?
You can use NPM as an alternative to bower, yes.
Every module has a bower.json because the module wants to support bower and npm as well. Module managers can write stuff like version number, ignore certain files to download, etc. You don't need to worry about these files.
Your package doesn't have a bower.json - perfect. You don't support bower.

Why is it recommeneded to install via bower or npm?

This might be a stupid question but I believe I should know this since I am just starting out in the web development field rather than just assuming. I normally see this
Install via npm or bower (recommended) or manually download the package
or something of that sorts. My Assumption is that the node_module and bower_component updates the packages automatically, however I am not sure.
Sometimes I install with npm or bower, or sometimes I just mannually download the package to which I have seen no difference. Could someone please tell me why it is important to install via npm or bower so I can know for sure what is going on.
Package managers allow you to keep third party code separate from your code and have consistent versions of that code. With npm or bower you can set out exactly what dependencies you project has, and what versions through a single file, without having to bloat your codebase with the dependencies themselves.
This means that anyone who wants to set up the project can just download the core code and run npm install or the equivalent command, and install all the dependencies at the latest supported version.