{prefix}/lib/node_modules
, and puts executable files in {prefix}/bin
, where {prefix}
is usually something like /usr/local
. It also installs man pages in {prefix}/share/man
, if they’re supplied.
$ npm install -g <package name> # example $ npm install -g express # now we can use express to generate a new app $ express new appIf you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.
./node_modules
, executables go in ./node_modules/.bin/
, and man pages aren’t installed at all.
$ cd /path/to/the/project $ npm install <package name> # example $ npm install express # now you can use `var express = require( 'express' );` in your appIf you’re installing something that you want to use in your program, using require('whatever'), then install it locally, at the root of your project.
$ npm uninstall -g <package name> # example $ npm uninstall -g express
$ cd /path/to/the/project $ npm uninstall <package name> # example $ npm uninstall express
$ npm search <package name> # example $ npm search express
$ npm ls -g
$ npm ls -gl
$ cd /path/to/the/project $ npm ls
$ cd /path/to/the/project $ npm ls -l
$ npm update -g
$ cd /path/to/the/project $ npm update
Technical Architect
Kuala Lumpur, Malaysia
I'm a Full Stack Web Developer working in a MNC and passionate of developing modern web and mobile applications.
I have designed and developed CodephpOnline & CodephpOnline Wiki platform to expatiate my coding and technology learning experiences.
In my leisure time, I write technical articles on web development such as PHP, Laravel, CodeIgniter, Mediawiki, Linux, Angular, Ionic, ReactJS, NodeJS, AJAX, jQuery, Cloud and more.