Maxim Velichkin Maxim Velichkin - 3 months ago 14
Javascript Question

I don't see the "node_modules/bin" folder after installing browserify

I'm trying to repeat this tutorial:

https://ampersandjs.com/learn/npm-browserify-and-modules/#npm-browserify-amp-modules

But after installing browserify I don't see folder:

node_modules/.bin


Instead I see a folder
node_modules/browserify
. Inside there is a
bin
folder, and Iinside of it -
cmd.js
and
args.js
.

How should I change this line of code in my case:
./node_modules/.bin/browserify app.js -o app.bundle.js
to compile all js files into one file?
Or maybe I need to install browserify some other way?

Answer

Put together, the flow of creating a very simple web application with these tools might look something like this:

You simply need to point your cmd prompt to the browserify node_module, so drop the .bin if it's not there => /node_modules/browserify yourjsfile.js myjsfile.bundle.js

As far as I can understand this guide: the app.js file or yourjsfile.js needs to have all the library requirements included in order for it to work.

var squareNumbers = require('./square-numbers');

This means you need to write this file as an entry point for all your scripts you need to bundle.

TIP: try to find a youtube video or something to get a better understanding of this guide.

The dot in front of these directories tells you it's a system folder, in this case, not of your operating system, but from another "system/application", like node. It puts these kind of folders alphabetically on top to make a distinction.

Comments