Link Search Menu Expand Document

Node & Npm

Table of contents

What is npm?

NPM is a package manager for the JavaScript programming language maintained by npm, Inc. npm is the default package manager for the JavaScript runtime environment Node.js. It consists of a command line client, also called npm, and an online database of public and paid-for private packages, called the npm registry.

Install and uninstall NodeJS

  • Download the package from: https://nodejs.org/en/download/
  • To uninstall node & npm, run below commands:
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp 

Npm update

sudo npm cache clean -f
sudo npm install -g n
sudo n 4.4.5
sudo npm install npm -g
    # update npm 

Node-gyp

sudo node-gyp configure
sudo node-gyp rebuild
sudo npm install -g node-gyp
sudo npm uninstall node-gyp -g
sudo npm uninstall node-gyp

Collapsify

sudo npm install -g collapsify

Express

npm install express --save

Yarn

npm install --global yarn