##Other Nifty Commands
- npm init
creates a package.json in root for you
- npm list
lists all installed packages
- npm prune
removes packages not depended on by your project according to your package.json
- npm outdated
tells you which installed packages are outdated with respect to what is current in the npm registry but allowable by the version definition in your package.json
- npm cache clean (--force)
limpia el cache
- npm cache verify
verifica la integridad del cache
- npm i paquete
i is for install
- -P, --save-prod: Package will appear in your dependencies. This is the default unless -D or -O are present.
- -D, --save-dev: Package will appear in your devDependencies.
- -O, --save-optional: Package will appear in your optionalDependencies.
- --no-save: Prevents saving to dependencies.
When using any of the above options to save dependencies to your package.json, there are two additional, optional flags:
- -E, --save-exact: Saved dependencies will be configured with an exact version rather than using npm's default semver range operator.
- -B, --save-bundle: Saved dependencies will also be added to your bundleDependencies list.
- npm view bootstrap
te informa sobre las versiones de la libreria bootstrap
- npm view boostrap | more
te muestra la informacion de la libreria bootstrap, pero una pantalla a la vez, CTRL+C (x2) para terminar
- npm ls | findstr "typescript"
¿Cómo puedo saber si "typescript" ya está instalado en la PC?
- npm list -g --depth=0
responde a "what npm packages do I have globally installed on this machine"
- npm install paquete@version
for example: npm install express@3.0.0
You can also add the --save flag to that command to add it to your package.json dependencies,
or --save --save-exact flags if you want that exact version specified in your package.json dependencies.
##npm install --save
By default, NPM simply installs a package under node_modules. When you're trying to install dependencies for your app/module, you would need to first install them, and then add them (along with the appropriate version number) to the dependencies section of your package.json.
The --save option instructs NPM to include the package inside of the dependencies section of your package.json automatically, thus saving you an additional step.
In addition, there are the complementary options --save-dev and --save-optional which save the package under devDependencies and optionalDependencies, respectively. This is useful when installing development-only packages, like grunt or your testing library.
Update npm 5:
As of npm 5.0.0, installed modules will be added as a dependency (--save) by default.