Tuesday 3 February 2015

NPM - Node Package Manager

NPM
 
npm is a package manager for JavaScript, and is default for Node.js

npm install package -g
fixing installation issue
  1. changing the directory as owner
      whoami – get user name
      sudo chown user_name directory
      npm config get prefix
      sudo chown -R user_name all directory
      (*** /usr/local/lib,/usr/local/bin,/usr/local/share)
     2. changing directory prefix
  1. mkdir /users/user_name/npm-global
    npm config set prefix /users/user_name/npm-global
    npm install -g newpackage
    trying to access newpackage cmd in terminal won't not working for that
Install npm package locally – not executable
Install npm package globally – executable

package.json name,version – required

dependencies install- npm install package - -save save the dependencies in package.json
update local package – npm update
list out packages using - npm ls
check outdated packages – npm outdated
uninstall package – npm uninstall package
uninstall package and remove from package.json dependencies – npm uninstall package –save
remove unwanted package download for project (dependencies not exist in package.json)-
npm prune

installing npm package globally – npm install package -g
note :error while installing use sudo npm install package -g
update also
npm install -g jshint
check outdated
npm outdated -g –depth=0

uninstall package
npm uninstall -g package
export.function

npm publish

semantic version
npm version patch

npm version minor
npm version major

minor version release update - npm install packag@1.x – minor version

No comments:

Post a Comment