NodeJS By Examples

NPM Config

 NPM Config

https://docs.npmjs.com/cli/config

 

List all configs

$ npm config list

; cli configs
registry = "https://registry.npmjs.org/"
user-agent = "npm/1.4.28 node/v0.10.33 linux ia32"

; node bin location = /usr/bin/node
; cwd = /home/frob
; HOME = /root
; 'npm config ls -l' to show all defaults.

 

Edit config file  /root/.npmrc

#npm config edit

This opens vi editor. Exit with ESC , :q+ENTER

If you want preview all default settings:

#cat /root/.npmrc

;;;;
; npm userconfig file
; this is a simple ini-formatted file
; lines that start with semi-colons are comments.
; read `npm help config` for help on the various options
;;;;


;;;;
; all options with default values
;;;;
; always-auth=false
; bin-links=true
; browser=null
; ca=null
; cafile=undefined
; cache=/root/.npm
; cache-lock-stale=60000
; cache-lock-retries=10
; cache-lock-wait=10000
; cache-max=null
; cache-min=10
; cert=null
; color=true
; depth=null
; description=true
; dev=false
; editor=vi
; email=
; engine-strict=false
; force=false
; fetch-retries=2
; fetch-retry-factor=10
; fetch-retry-mintimeout=10000
; fetch-retry-maxtimeout=60000
; git=git
; git-tag-version=true
; global=false
; globalconfig=/usr/etc/npmrc
; group=1000
; heading=npm
; ignore-scripts=false
; init-module=/root/.npm-init.js
; init.author.name=
; init.author.email=
; init.author.url=
; init.license=ISC
; json=false
; key=null
; link=false
; local-address=undefined
; loglevel=warn
; long=false
; message=%s
; node-version=0.10.33
; npat=false
; onload-script=null
; optional=true
; parseable=false
; prefix=/usr
; production=false
; proprietary-attribs=true
; proxy=null
; https-proxy=null
; user-agent=npm/{npm-version} node/{node-version} {platform} {arch}
; rebuild-bundle=true
; registry=https://registry.npmjs.org/
; rollback=true
; save=false
; save-bundle=false
; save-dev=false
; save-exact=false
; save-optional=false
; save-prefix=^
; searchopts=
; searchexclude=null
; searchsort=name
; shell=/bin/bash
; shrinkwrap=true
; sign-git-tag=false
; spin=true
; strict-ssl=true
; tag=latest
; tmp=/tmp
; unicode=true
; unsafe-perm=false
; usage=false
; user=1000
; username=
; userconfig=/root/.npmrc
; umask=18
; version=false
; versions=false
; viewer=man
; _exit=true
; globalignorefile=/usr/etc/npmignore

 

 

 

 

 

 

Install packages over http or https

$ npm config set registry http://registry.npmjs.org/

$ npm config set registry https://registry.npmjs.org/

 

COMMON ERROR:

When we list all packages with command  #npm list -g we can get error UNMET DEPENDENCY inherits * .

This can be solved with: