简体   繁体   中英

How to add browserify as a dependency of your node.js application?

My node.js application depends on the fact browserify is available on the command line, as it uses it on a shell script. How can I make sure it is available on the application without having to require my client to install it manually via npm install ?

Since you're not giving too much context, I'm assuming that your external dependencies are located in ./node_modules in your app's directory.

In that case, just install browserify as an extra (local) dependency, which will make it available as ./node_modules/.bin/browserify . That's also how you can refer to it from your shell script.

An even better option is to install browserify as follows:

npm install --save browserify

This not only installs browserify for you, but also adds it as a dependency to your dependencies in your package.json file.

Now when someone installs your module ie via npm install yourmodule , browserify will be installed automatically into its ./node_modules .

This of course works for any module you depend on, not only browserify.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM