title: Install node.js npm on Ubuntu 16.04 and Plesk Onyx
body: <p>I am following <a href="http://sscnet.ch/content/install-nodejs-npm-less-ubuntu-plesk" rel="nofollow noreferrer">this guide</a> to install npm without erasing Plesk (as I already did) with <code>sudo apt-get install npm</code> and most of all the steps seems to be completed but, when I run <code>npm --version</code> shows that the command npm was not found:</p>
  <pre><code>user@server:~$ npm --version
  The program 'npm' is currently not installed. You can install it by typing:
  sudo apt install npm
  </code></pre>
  <p>If I do that my Plesk will be uninstalled.</p>
  <p>This what I get when run <code>sudo apt-get -s install npm</code>:</p>
  <blockquote>
  <p>user@server:~$ sudo apt-get install -s npm</p>
  <p>Reading package lists... Done</p>
  <p>Building dependency tree</p>
  <p>Reading state information... Done</p>
  <p>The following additional packages will be installed:</p>
  <p>gyp libjs-inherits libjs-node-uuid libjs-underscore libuv1-dev node-abbrev node-ansi node-ansi-color-table node-archy node-async node-block-stream</p>
  <p>node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream node-fstream-ignore node-github-url-from-git</p>
  <p>node-glob node-graceful-fs node-gyp node-inherits node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp</p>
  <p>node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv node-qs node-read node-read-package-json</p>
  <p>node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent node-underscore node-which nodejs-dev</p>
  <p>python-pkg-resources</p>
  <p>Suggested packages:</p>
  <p>javascript-common node-hawk node-aws-sign node-oauth-sign node-http-signature debhelper python-setuptools</p>
  <p>Recommended packages:</p>
  <p>javascript-common</p>
  <p>The following NEW packages will be installed:</p>
  <p>gyp libjs-inherits libjs-node-uuid libjs-underscore libuv1-dev node-abbrev node-ansi node-ansi-color-table node-archy node-async node-block-stream</p>
  <p>node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream node-fstream-ignore node-github-url-from-git</p>
  <p>node-glob node-graceful-fs node-gyp node-inherits node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp</p>
  <p>node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv node-qs node-read node-read-package-json</p>
  <p>node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent node-underscore node-which nodejs-dev npm</p>
  <p>python-pkg-resources</p>
  <p>0 upgraded, 54 newly installed, 0 to remove and 0 not upgraded.</p>
  <p>Inst python-pkg-resources (20.7.0-1 Ubuntu:16.04/xenial [all])</p>
  <p>Inst gyp (0.1+20150913git1f374df9-1ubuntu1 Ubuntu:16.04/xenial [all])</p>
  <p>...</p>
  <p>...</p>
  <p>Inst node-sha (1.2.3-1 Ubuntu:16.04/xenial [all])</p>
  <p>Inst node-slide (1.1.4-1 Ubuntu:16.04/xenial [all])</p>
  <p>Inst npm (3.5.2-0ubuntu4 Ubuntu:16.04/xenial [all])</p>
  <p>Conf python-pkg-resources (20.7.0-1 Ubuntu:16.04/xenial [all])</p>
  <p>...</p>
  <p>...</p>
  <p>Conf node-retry (0.6.0-1 Ubuntu:16.04/xenial [all])</p>
  <p>Conf node-sha (1.2.3-1 Ubuntu:16.04/xenial [all])</p>
  <p>Conf node-slide (1.1.4-1 Ubuntu:16.04/xenial [all])</p>
  <p>Conf npm (3.5.2-0ubuntu4 Ubuntu:16.04/xenial [all])</p>
  <p>N: Ignoring file 'plesk.list.ai_back' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension</p>
  </blockquote>
  <p>And after <code> curl -L https://www.npmjs.com/install.sh | sudo sh</code>:</p>
  <blockquote>
  <p>user@server:~$ curl -L <a href="https://www.npmjs.com/install.sh" rel="nofollow noreferrer">https://www.npmjs.com/install.sh</a> | sudo sh</p>
  <p>% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current</p>
  <p>Dload  Upload   Total   Spent    Left  Speed</p>
  <p>100  6255  100  6255    0     0  12330      0 --:--:-- --:--:-- --:--:-- 12337</p>
  <p>tar=/bin/tar</p>
  <p>version:</p>
  <p>tar (GNU tar) 1.28</p>
  <p>Copyright (C) 2014 Free Software Foundation, Inc.</p>
  <p>License GPLv3+: GNU GPL version 3 or later <a href="http://gnu.org/licenses/gpl.html" rel="nofollow noreferrer">http://gnu.org/licenses/gpl.html</a>.</p>
  <p>This is free software: you are free to change and redistribute it.</p>
  <p>There is NO WARRANTY, to the extent permitted by law.</p>
  <p>Written by John Gilmore and Jay Fenlason.</p>
  <p>install npm@latest</p>
  <p>fetching: <a href="https://registry.npmjs.org/npm/-/npm-5.3.0.tgz" rel="nofollow noreferrer">https://registry.npmjs.org/npm/-/npm-5.3.0.tgz</a></p>
  <p>added 1 package and removed 1 package in 1.433s</p>
  <p>/usr/bin/npm -&gt; /usr/lib/node_modules/npm/bin/npm-cli.js</p>
  <p>/usr/bin/npx -&gt; /usr/lib/node_modules/npm/bin/npx-cli.js</p>
  <ul>
  <li>npm@5.3.0</li>
  </ul>
  <p>updated 1 package in 2.473s</p>
  <p>It worked</p>
  </blockquote>
  <p>If I run <code>ls /usr/bin/npm</code> I get: <code>/usr/bin/npm</code> so I could use something like export <code>PATH=$PATH:/usr/bin/npm</code> or something like this?</p>
  <p>Thanks in advance.</p>