Npm : Différence entre versions

De WikiSys
Aller à : navigation, rechercher
 
Ligne 4 : Ligne 4 :
 
  npm cache clean
 
  npm cache clean
 
  npm cache clean --force
 
  npm cache clean --force
 +
 +
== npm install ==
 +
* https://docs.npmjs.com/cli/install
 +
 +
DESCRIPTION§
 +
 +
This command installs a package, and any packages that it depends on. If the package has a package-lock or shrinkwrap file, the installation of dependencies will be driven by that, with an npm-shrinkwrap.json taking precedence if both files exist. See package-lock.json and npm-shrinkwrap.
 +
 +
A package is:
 +
 +
*    a) a folder containing a program described by a package.json file
 +
*    b) a gzipped tarball containing (a)
 +
*    c) a url that resolves to (b)
 +
*    d) a <name>@<version> that is published on the registry (see npm-registry) with (c)
 +
*    e) a <name>@<tag> (see npm-dist-tag) that points to (d)
 +
*    f) a <name> that has a “latest” tag satisfying (e)
 +
*    g) a <git remote url> that resolves to (a)
 +
 +
Even if you never publish your package, you can still get a lot of benefits of using npm if you just want to write a node program (a), and perhaps if you also want to be able to easily install it elsewhere after packing it up into a tarball (b)
  
 
== npm uninstall ==
 
== npm uninstall ==

Version actuelle en date du 14 juillet 2019 à 15:12

npm init
npm cache verify
npm cache clean
npm cache clean --force

npm install

DESCRIPTION§

This command installs a package, and any packages that it depends on. If the package has a package-lock or shrinkwrap file, the installation of dependencies will be driven by that, with an npm-shrinkwrap.json taking precedence if both files exist. See package-lock.json and npm-shrinkwrap.

A package is:

  • a) a folder containing a program described by a package.json file
  • b) a gzipped tarball containing (a)
  • c) a url that resolves to (b)
  • d) a <name>@<version> that is published on the registry (see npm-registry) with (c)
  • e) a <name>@<tag> (see npm-dist-tag) that points to (d)
  • f) a <name> that has a “latest” tag satisfying (e)
  • g) a <git remote url> that resolves to (a)

Even if you never publish your package, you can still get a lot of benefits of using npm if you just want to write a node program (a), and perhaps if you also want to be able to easily install it elsewhere after packing it up into a tarball (b)

npm uninstall

npm uninstall <name> removes the module from node_modules, but not package.json
npm uninstall <name> --save also removes it from dependencies in package.json
npm uninstall <name> --save-dev also removes it from devDependencies in package.json
npm -g uninstall <name> --save also removes it globally

Sous pages