Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of .bin folder in node_modules?

Tags:

node.js

bower

Today one colleague explained me how to create nodejs projects and I notice that in ./node_modules there is an invisible folder named .bin. I must said that I discovered this after adding to the project "bootcamp" and "bower" tools. What's .bin purpose? What is it created for?

like image 503
Cremix_hellven Avatar asked Aug 14 '14 10:08

Cremix_hellven


People also ask

What is .bin folder?

The bin folder holds binary files, which are the actual executable code for your application or library. Each of these folders are further subdivided into Debug and Release folders, which simply correspond to the project's build configurations.

What is bin in package JSON?

bin. A lot of packages have one or more executable files that they'd like to install into the PATH. npm makes this pretty easy (in fact, it uses this feature to install the "npm" executable.) To use this, supply a bin field in your package. json which is a map of command name to local file name.

What is npm bin?

The command npm bin lets you find out where the closest executables are: $ npm bin /tmp/node_modules/.bin. If your shell is bash then you can define the following command for running executables from that directory: function npm-do { (PATH=$(npm bin):$PATH; eval $@;) }

Why do node modules go into .staging folder?

staging" means, those dependencies are getting downloaded so for the temporary basis it keeps all those dependencies under ". staging" folder. Once all gets downloaded properly then it will showcase them under node_modules only.


1 Answers

That is a folder where binaries (executables) from your node modules are located.

NPM site states:

Executables When in global mode, executables are linked into {prefix}/bin on Unix, or directly into {prefix} on Windows.

When in local mode, executables are linked into ./node_modules/.bin so that they can be made available to scripts run through npm. (For example, so that a test runner will be in the path when you run npm test.)

like image 160
alandarev Avatar answered Oct 12 '22 12:10

alandarev