The main difference between installing a package globally is that you start executing commands on the command line, according to the [npm doc]) link ):
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 looks like this:
There are two ways to install packages: locally or globally. Choose what kind of installation 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 you would have if you were installing grunt, for example.
If you want to depend on the package in your own module, then install it locally. This is the choice you would use if you are using require, for example.
It depends on the operating system and configuration, but usually the packages are located inside the user's folder.
- MacOS: / usr / local / lib / node_modules
- Windows: \ AppData \ Roaming \ npm
I did not quite understand the de onde é buscado
question. Both npm i
commands with or without -g
will download the last stable package published in NPM, remembering that the version of the package that will be downloaded may be another depending on your package.json
file. Documentation
If you install vue
globally it will not make any difference because this package must be installed locally (unless you npm link
because then it fetches the package globally). Documentation
- It's okay for you to upgrade vue-cli as it's 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 their documentation :
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 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 next in the next few sections of the guide.