In my package.json
file, I have bower listed as a dependency. After I run npm install
, bower gets installed locally. When I try to run bower after installing it locally I get an error
"bower" is not recognized as an internal or external command
It seems the only way to resolve this is to install bower globally. Why should I have to do this? If my project contains a local copy of bower, why won't node use it?
globally —- This drops modules in {prefix}/lib/node_modules , and puts executable files in {prefix}/bin , where {prefix} is usually something like /usr/local . It also installs man pages in {prefix}/share/man , if they're supplied. locally —- This installs your package in the current working directory.
Installing a package globally allows you to use the code in the package as a set of tools on your local computer. To download and install packages globally, on the command line, run the following command: npm install -g <package_name>
Installing the local dependencies means the module will be available only for a project you installed in the same directory. Global installing dependencies puts the module into your Node.
npm packages can be installed globally using the -g or --global flag so that the package can be used from the console.
Installing locally makes bower available to the current project (where it stores all of the node modules in node_modules
). This is usually only good for using a module like so var module = require('module');
It will not be available as a command that the shell can resolve until you install it globally npm install -g module
where npm will install it in a place where your path variable will resolve this command.
Edit: This documentation explains it pretty thorougly.
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