The main difference between installing a package globally is that you start executing the commands on the command line, according to the [doc of npm])https://docs.npmjs.com/getting-started/installing-npm-packages-globally#how-to-install-global-Packages):
There are two Ways to install npm Packages: locally or globally. Choose which Kind of installation to use based on how you want to use the package.
If you want to use a package as a command line tool, then install it globally. This way, it Works no Matter which directory is Current. This is the Choice you would use if you Were Installing Grunt, for example.
If you want to Depend on the package from your Own module, then install it locally. This is the Choice you would use if you are using require statements, for example.
Translated like this:
There are two ways to install packages: locally or globally. Choose which installation type based on how you want to use the package.
If you want to use the package as a command line tool, then install the command globally. This way, the command works regardless of which directory you are in. This is the choice that you user if installing Grunt, for example.
If you want to depend on the package in its own module, then install it locally. This is the choice you would use if using require, for example.
It depends on the operating system and configuration performed, but usually the packages are located inside the user folder.
- Macos: /usr/local/lib/node_modules
- Windows: Appdata Roaming npm
I don’t quite understand the question de onde é buscado
. Both commands npm i
with or without -g
will download the latest stable package published on NPM, remembering that the version of the package that will be downloaded may be another depending on your file package.json
. Documentation
If you install the vue
globally will make no difference as this package needs to be installed locally (unless you perform a npm link
because then he will pick up the package in the global). Documentation
- No problem you update Vue-cli as it is a development tool.
- When you talk about installing Vue.js globally, you say install the Vue-cli package, right? Cli packages are usually not installed locally because it is a tool to use via command line, according to the documentation theirs:
The CLI (@Vue/cli) is a globally installed npm package and provides the Vue command in your terminal. It provides the Ability to quickly scaffold a new project via Vue create, or Instantly prototype new Ideas via Vue serve. You can also Manage your Projects using a Graphical user interface via Vue ui. We will walk through what it can do in the next few sections of the guide.
Thanks for helping out, man. As your answer to the second question, then pq install globally, if in another project it downloads again from NPM, why then install globally? I didn’t understand the difference between the two facilities.
– LeAndrade
When we executed the
npm i
in another project, npm will download the packages defined in the configuration filepackages.json
. I translated the first citation of the NPM document. See if it gets clearer.– Fonts