Difference between revisions of "Npm"

From Logic Wiki
Jump to: navigation, search
(Created page with "Category:Node.js Category:npm to list all the packages and their dependencies with their version numbers npm list if we only want to list first level of packages n...")
 
Line 24: Line 24:
 
install dependencies
 
install dependencies
 
  npm i
 
  npm i
 +
== Developer Dependencies ==
 +
npm i jshint --save-dev
 +
if a package is installed with --save-dev it will only be available in dev env. and not goes to production env.

Revision as of 13:12, 16 September 2018


to list all the packages and their dependencies with their version numbers

npm list

if we only want to list first level of packages

npm list --depth=0

To see the meta data of a package

npm view packageName

To see just the dependencies of a package

npm view packageName dependencies

Updating local packages

to list which updates are available

npm outdated 

to update minor and patch

npm update

to update majors first install this

sudo npm i -g npm-check-updates 

to see available updates run

npm-check-updates

to update package.json

npm-check-updates -u
ncu -u

install dependencies

npm i

Developer Dependencies

npm i jshint --save-dev

if a package is installed with --save-dev it will only be available in dev env. and not goes to production env.