.bowerrc option to make bower install assume --save - node.js

I noticed here that there was some work towards adding a .bowerrc option to make bower install automatically --save.
After searching and looking in the docs I couldn't find a way to use it. After browsing the source of both bower and bower-config I couldn't find any other reference to it. Does anyone know if this is implemented and can be used somehow, or if it's still work in progress?

I think it comes from here:
https://github.com/bower/bower/issues/1040
but it's in progress, they've planned it for version 2.0

Related

Can you prevent node.js from installing packages locally? (Use global packages)

I've been working on a lot of different node.js projects. All of them have their own package.json file with their own needed packages. Every time I run node <mainfile>.js, npm installs all the packages to the project directory. Like so: C:/Users/me/Projects/<project-name>/node_modules.
This isn't a very big problem, but is there a way to make npm use/install to the global packages? Like in C:/Users/me/node_modules?
One of the advantages I could see this having is less storage being taken up, although it isn't a huge advantage.
I would assume that if it is possible, it would require you to add/modify something in the package.json file.
While looking into answers for this question, I've seen people saying that you should avoid installing packages globally. Can you also explain why this is a bad practice andy why I should avoid it?
Install Package Globally
NPM installs global packages into //local/lib/node_modules folder.
Apply -g in the install command to install package globally.
npm install -g express
To answer your other question
The obvious short answer is that your project depends on them. If your
project depends on a package, it should be documented in package.json
so that you can guarantee that it is installed when someone types npm
install. Otherwise, you’ll need to add extra steps in your README file
to inform anyone else who clones your project that they need to
install each of your global dependencies as well
Finally, even if someone installs the correct version of Browserify
for your project, they may be working on a different project that
requires a different version of that same tool, which would cause
conflicts. Several of your own projects might even use different
versions of Browserify because you updated it when you started a new
project and didn’t go back to make sure that earlier projects were
updated to work with the new version. These conflicts can be avoided.
You can only have one version installed globally. This causes problems if you have different projects that rely on different versions of a package.
Why not to install all packages globally
It's not really you shouldn't install a package globally it's more knowing what packages to install globally. The packages to install globally are ones that your project/application does not depend on.
How to identify a package that my project depends on
A package that your project is depended on is a package that your application could not run without like axios or express (an express API could not run without express installed or a web page that makes API requests with axios cant make those requests without axios) but something like http-server or minify is not needed to run the application so it can be installed globally.
Why is it important to have locally installed packages
It's important/good practice because if you are working with a group of developers or someone gets your work from Github they can just run npm install and get all the packages with out having to find all the packages them selfs.
How can I remove the node modules folder
You could technically globally install every package but I would sudjest not to. Node and many other developers know this is an issue that they have created a solution for in deno "the node killer".
I would recommend not installing all packages globally and if the node modules folder really annoys you try deno it fixes a lot of things that node developers hate.

Possible to "npm install" code changes added since last version number change?

This is a n00b npm question, as I'm just getting started here. Apologies.
I'm using the node-dbus npm module, whose latest version is 0.2.0. But I see that there have been code changes (one of which I want) added since the last version number change.
Do I need to ask the author of the package to update the version number so I can easily get the new stuff? Is it permissible/possible for me to go in and update the version number myself in the github repo? Or is there some clean way to set up the dependencies line in my package.json to get the stuff that has been added since the last version number change?
I see that it's supposed to be possible to use a "git remote url," but so far I'm unable to make that work. Is that what I should be doing? Is getting the version number updated the right direction?
Thanks for your help.
Steve
According to the official NPM documentation, you can install a package by:
npm install <githubname>/<githubrepo>[#<commit-ish>]
In your case, it should be:
npm install sidorares/node-dbus#<the-commit-that-contains-your-wanted-code>
You can add --save to the command to update package.json on the fly.
Please be aware that it is not a good practice to install modules from source code directly as it might not be a stable version.

Bower to Sails - What have I missed?

I have been struggling with this and would appreciate any help you can offer.
I have a fresh install of sails and have configured it to use handlebars. It lift beautifully.
I have installed bower using
npm i sails-generate-bower
After a quick
bower install bootstrap --save
I can see that it has generated the core bootstrap files in
/bower_components //the root of my project
What do I do now to ensure that upon lift I have the Bootstrap files in the correct places?
Their are many ways to do this.
You either configure your asset pipeline config/tasks/pipeline.js or HERE a similar question and valid answer.
Documentation

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).

Why would you install node using bower

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.

Resources