Locally installed versus globally installed NPM modules

前端 未结 4 1822
醉梦人生
醉梦人生 2020-12-15 03:03

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

4条回答
  •  春和景丽
    2020-12-15 03:28

    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.

提交回复
热议问题