Using downloaded modules with npm
In addition to the modules internal to Node.js, it is possible to import modules from the internet using the npm
utility provided with Node.js.
For this, the npm
command is used (in a command interpreter) by indicating arguments that allow you to perform the corresponding actions on the imported modules.
Using the npm command
Here are some common uses of the npm
command:
npm install moduleName
: Installs the indicated module in the localnode_modules
directory. The module will only be accessible for the current application and not for other applications (unless it is installed again).npm install moduleName -g
: Installs the specified module in the globalnode_modules
directory. The-g
option allows you to indicate that this module can be accessed by other applications because it is installed in thenode_modules
directory of Node.js (globally).npm link moduleName
: It is possible that a module installed globally (with the-g
...