Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 997 Bytes

install-npm.md

File metadata and controls

36 lines (28 loc) · 997 Bytes

Install NPM

NPM (Node.js Package Manager) is the package manager for JavaScript. We use it for gitbook and similar.

Official page: link

Install NPM (Ubuntu)

sudo apt install npm

Using NPM

npm install (with no args, in package dir)
npm install [<@scope>/]<name>
npm install [<@scope>/]<name>@<tag>
npm install [<@scope>/]<name>@<version>
npm install [<@scope>/]<name>@<version range>
npm install <git-host>:<git-user>/<repo-name>
npm install <git repo url>
npm install <tarball file>
npm install <tarball url>
npm install <folder>

In global mode (with -g or --global), it installs the package as a global package, so may require sudo.

Troubleshooting NPM

Hack for phantomjs and svgexport is to use --unsafe-perm if fails even with sudo:

sudo npm -g install phantomjs-prebuilt --upgrade --unsafe-perm
suod npm -g install svgexport --unsafe-perm