Why would you install node using bower - node.js

Ok it may sound like a stupid question.
But I was wondering, why would one install node using bower. I mean bower already requires nodejs and npm as clearly stated on their website, right?
Will try to make it more clear by adding what I added as comment below:
I mean bower already need node and npm, then why would someone use bower to install node again? What's the point? Is there any specific use case? I cant think of any though!

I'm not sure if I understand your question right, but it seems like you are confused on something there.
npm or Node Package Manager it is use for installing/managing the node modules server sides
Usage example: npm install express or npm install bower -g
Whereas bower you use that to install anything that is use client-side
Usage example: bower install jquery or bower install font-awesome
Ignore my above answer if you are talking about why there is a package on the bower component for node.
If so I think they've registered that in bower but not even sure what can you really do with that since most of the stuff would require you to run it server-side, but some library maybe accessible/usable client-side. I have to search/find the example from that to demonstrate but I couldn't find one at the moment.

Related

Do I need to install dependencies one-by-one? (and if so, why?)

I'm porting a node/Express app to Heroku, and it keeps crashing. The log first said, "Error: Cannot find module 'mongoose'" I then (re-)installed mongoose. Then it crashed with "Error: Cannot find module 'moment'"
I require mongoose, moment, etc. in my app. Isn't npm install by itself supposed to take care of the dependencies, or do I additionally have to add all these dependencies, one-by-one, to the package.json file, in addition to npm install? Tks!
In the older version of NPM (5.0.0 or earlier), you had to add --save as a flag to the npm install as:
npm i package-name --save
And it would add it to your package.json. As of 5.0.0 and later, it automatically adds it to the package file.
To answer your question, yes, you will have to add them one at a time for now. And keep in mind what I said before, because if you are using an older version of NPM, make sure you use --save when you are installing so you don't have to do extra work :-)

relationship between webpack, npm, bower, gulp

I have recently just went in web-development and heard about these tools, I still confusing about it even I done research after, and also I have some questions as well. this is the following research I have done if there are something wrong please correct me.
Webpack is replacing bower and gulp
Bower was use to manage front end lib(eg: bootstrap), which gulp was use to manage backend lib(eg: backbone.js )
In some big project people still use gulp because give more control of the project
npm is the package manager for JavaScript.
If I want to I can install bootstrap from either npm or bower or gulp.
People choose to use bower and not just npm to install bootstrap is because npm does nested dependency tree, which Bower requires a flat dependency tree, which means faster.
Webpack replacing bower and gulp is because those are overkilling people's time.
The last thing is a question, I saw on youtube people download sass sass(which I understand is a front end thing tool)eg:(npm install gulp gulp-sass --save-dev) in gulp and then not using bower, is that even the the right way to do things? because if yes why do we still need to use use bower?
Webpack can be an alternative for gulp. Webpack doesn't do anything Bower does.
Bower was often used to manage frontend dependencies (eg, bootstrap), while npm was often used to manage backend dependencies (eg, express).
People use gulp because it's worked out for them so far, and the time/effort it takes to learn something else and switch to something else might not be worth it.
npm is a package manager for dependencies, but it isn't exclusive to JavaScript dependencies.
You can install bootstrap with Bower or npm.
Starting with version 3, npm installs everything in a flat hierarchy. You can use npm to manage dependencies that are used on the frontend AND backend, so some people don't see the point in having Bower.
Webpack can be an alternative to Gulp, but a lot of people had a hard time learning how to use Webpack.
Yes, you would npm install gulp-sass --save-dev, which installs gulp-sass with npm. I imagine gulp-sass is a tool that lets you use SASS and Gulp together. You wouldn't use Bower in any of this.

Do I have to learn node.js in order to use npm?

I need to use a package on npm, so I'm trying to learn how to use npm. The tutorials are fine, but I feel like they're assuming I know node.js, which I don't, and I'm having a hard time finding a tutorial for npm that doesn't also assume I know node.js. Do I need to learn node.js to use npm?
you don't need to know anything about node to use npm, its just a package manager. Install npm and then npm install all the packages you want. You will need to learn the npm toolchain, however, and it also helps to know which options are available for the various commands.
At the very least you should know the difference between installing a package globally and installing a package locally, i.e npm install -g vs. npm install respectively.

Confused in starting a project in node.js with npm install

Hello I am just a noob and still learning. I have already downloaded and tried the chat tutorial of get-started part from socket.io. Now, I am again learning from another source. What's confusing me is that, do I always have to npm install in the beginning of every project after writing the dependencies in the package.json? Or is there any other way? I would be very glad if you could help me understand my confusion. Thank you!
Yes, before running, all dependencies must be installed. So you must run npm install.
When developing, you can use npm install --save <package_name> to install a dependency and automatically add it to package.json.
NPM means Node Package Manager. It is used to manage your dependencies to other node modules dynamically thanks to a configuration file called package.json. This way you can easily define the exact versions you need or a mask in order to always retrieve the stable ones for instance.
The command npm install allows to interpret your configuration file and then download the good versions (and this recursively).

Additional installation steps with npm install

I can't find this documented anywhere, but I'm working on a node package that will be installed via npm install -g. This includes a binary and also several other sub packages that will be yeoman generators. As far as I can tell, these also have to be installed via npm install -g (or npm link). There doesn't seem to be any other way to use a generator. If there is, it would be fine to point yeoman to one of the generators relative to this project too.
When my package is installed, I want all of the generators to be installed as well since my script will ultimately end up calling yo one-of-my-generators.
Is there anything I can do to make npm install of my project also install/link all of the generators it contains in one step?
add them as peerDependencies in your package.json file. See the blog at http://blog.nodejs.org/2013/02/07/peer-dependencies/
Its also how we install things like mocha

Resources