What's the purpose of the .bin
directory within node_modules
?
In another question, the answerer stated:
"it's where your binaries (executables) from your node modules are located."
So additionally can someone explain to me the following: What are binaries/executables?
Any help would be greatly appreciated!
Binary or executable files are files which have already been compiled for your specific computer architecture and, once installed, these files can be ran directly on your computer. Common instruction set architectures are: X86 and ARM, which most computer processors are based upon. Contrary to binary files, source files are the actual source code itself and these files need to be compiled prior to installing.
As for the .bin
directory, within ./node_modules/.bin
, this directory stores all the executables of your node_modules
for which your project is dependent upon to run. This allows your project to just 'run' the libraries which are necessary, for your project, without you having to worry about compiling these files yourself. By compiling I mean transforming the source code down to executable code (machine code) which can understood by your computer's underlying processor.
Hopefully that helps!
According to npm docmentation
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.)
Binaries are executable files ( the compiled version of your file for a specific computer architecture) and once installed they can be run directly from your machine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With