Reputation: 3024
I install Browserify:
npm install -g browserify
then I try to run it:
$ browserify main.js > bundle.js
and Windows says
'browserify' is not recognized as an internal or external command
Why is that? The Browserify page promises it will work, but it does not.
Upvotes: 8
Views: 12259
Reputation: 29
As of December 12th 2021
Use this command in cmd
to convert your file :
npx browserify index.js -o bundle.js
at index.js
, place your file name instead of this.
Upvotes: 2
Reputation: 191
Try this:
npx browserify index.js -o bundle.js
NPX is a little-known command that is used to run binaries from modules that are installed locally in node_modules.
Upvotes: 6
Reputation: 15399
First, I installed browserify: npm i -D browserify
Then I ran node .\node_modules\browserify\bin\cmd.js
instead of browserify
.
For example, instead of:
browserify index.js -o bundle.js
I ran:
node .\node_modules\browserify\bin\cmd.js index.js -o bundle.js
Upvotes: 7
Reputation: 261
I had similar problem and resolved it by editing my Environmental Variables.
In other words I added the path to where my npm folder holding browserify was to list of Environmental Variables, PATH.
Hope this helps:)
Upvotes: 1
Reputation: 2069
I resolved this issue by
npm uninstall browserify --save
npm install browserify -g
npm install browserify-shim -- save
Upvotes: 8
Reputation: 3024
I found a problem. I had a corrupted installation of npm package, which did not create "browserify.cmd" file for some reason. I reinstalled it and now it works fine.
Upvotes: 1