Install node.js npm on Ubuntu 16.04 and Plesk Onyx

I am following this guide to install npm without erasing Plesk (as I already did) with sudo apt-get install npm and most of all the steps seems to be completed but, when I run npm --version shows that the command npm was not found:

user@server:~$ npm --version
The program 'npm' is currently not installed. You can install it by typing:
sudo apt install npm

If I do that my Plesk will be uninstalled.

This what I get when run sudo apt-get -s install npm :

user@server:~$ sudo apt-get install -s npm

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following additional packages will be installed:

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

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

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

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

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

python-pkg-resources

Suggested packages:

javascript-common node-hawk node-aws-sign node-oauth-sign node-http-signature debhelper python-setuptools

Recommended packages:

javascript-common

The following NEW packages will be installed:

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

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

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

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

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

python-pkg-resources

0 upgraded, 54 newly installed, 0 to remove and 0 not upgraded.

Inst python-pkg-resources (20.7.0-1 Ubuntu:16.04/xenial [all])

Inst gyp (0.1+20150913git1f374df9-1ubuntu1 Ubuntu:16.04/xenial [all])

...

...

Inst node-sha (1.2.3-1 Ubuntu:16.04/xenial [all])

Inst node-slide (1.1.4-1 Ubuntu:16.04/xenial [all])

Inst npm (3.5.2-0ubuntu4 Ubuntu:16.04/xenial [all])

Conf python-pkg-resources (20.7.0-1 Ubuntu:16.04/xenial [all])

...

...

Conf node-retry (0.6.0-1 Ubuntu:16.04/xenial [all])

Conf node-sha (1.2.3-1 Ubuntu:16.04/xenial [all])

Conf node-slide (1.1.4-1 Ubuntu:16.04/xenial [all])

Conf npm (3.5.2-0ubuntu4 Ubuntu:16.04/xenial [all])

N: Ignoring file 'plesk.list.ai_back' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension

And after curl -L https://www.npmjs.com/install.sh | sudo sh curl -L https://www.npmjs.com/install.sh | sudo sh :

user@server:~$ curl -L https://www.npmjs.com/install.sh | sudo sh

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 6255 100 6255 0 0 12330 0 --:--:-- --:--:-- --:--:-- 12337

tar=/bin/tar

version:

tar (GNU tar) 1.28

Copyright (C) 2014 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

install npm@latest

fetching: https://registry.npmjs.org/npm/-/npm-5.3.0.tgz

added 1 package and removed 1 package in 1.433s

/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js

/usr/bin/npx -> /usr/lib/node_modules/npm/bin/npx-cli.js

  • npm@5.3.0
  • updated 1 package in 2.473s

    It worked

    If I run ls /usr/bin/npm I get: /usr/bin/npm so I could use something like export PATH=$PATH:/usr/bin/npm or something like this?

    Thanks in advance.


    Just install native Node.js support in Plesk Installer and you will get npm as

    /opt/plesk/node/6/bin/npm

    and

    /opt/plesk/node/7/bin/npm

    链接地址: http://www.djcxy.com/p/19080.html

    上一篇: 将强类型的HTML帮助器值变为简单的参数类型

    下一篇: 在Ubuntu 16.04和Plesk Onyx上安装node.js npm