How to install nodejs on Ubuntu? - node.js

I install Ubuntu 16.04 on VPS.
My framework is laravel 5.6.
Upload my project on /var/www/html
After run sudo apt-get install -y nodejs this code, show this error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 132 not upgraded.
Need to get 0 B/12.8 MB of archives.
After this operation, 62.5 MB of additional disk space will be used.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_TIME = "fa_IR",
LC_MONETARY = "fa_IR",
LC_ADDRESS = "fa_IR",
LC_TELEPHONE = "fa_IR",
LC_NAME = "fa_IR",
LC_MEASUREMENT = "fa_IR",
LC_IDENTIFICATION = "fa_IR",
LC_NUMERIC = "fa_IR",
LC_PAPER = "fa_IR",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package nodejs.
(Reading database ... 73714 files and directories currently installed.)
Preparing to unpack .../nodejs_9.11.1-1nodesource1_amd64.deb ...
Unpacking nodejs (9.11.1-1nodesource1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nodejs (9.11.1-1nodesource1) ...
And run node -v show this error:
node: error while loading shared libraries: libuv.so.1: cannot open shared object file: No such file or directory
How to install npm and node on ubuntu 16.4 without error?

I strongly suggest using the Node Version Manager, it works on many barebones systems as well, and will let you further troubleshoot the specific issues related to that version of Node. AFAICT the specific error you're seeing is related to the particular snapshot of 16.04 (not 16.4) that you are using regarding a common C library. I would suggest two things to resolve this if using a different Node version doesn't already solve this:
Google the shared object to find what Ubuntu library is needed, and perhaps installation of that may solve it.
If it's already installed or the error persists, you may need to adjust your LD_LIBRARY_PATH and other C-level env variables during installation to refer to the location of the library.
Contact your OS admin or cloud provider to discuss solutions for the missing object.

The error is not related to node, but to your ubuntu that is misconfigured. Run
sudo locale-gen en_US.UTF-8 #### ---> or the locale you are actually using
sudo dpkg-reconfigure locales
to configure your system's locales. After that, uninstall nodejs
sudo apt remove --purge nodejs
Now, follow the advice on nodejs' website on how to install nodejs via package managers. To install node, do the following:
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
Now you'll have a working ubuntu (at least for the related parts), and nodejs

Try to use nvm (Node Version Manager) you can install it from the terminal
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
It will set all the environment for you (like to enable the node command in the terminal, same for npm) and the nvm let you download and change de current version of Nodejs in your device in very simple way which is a very good feature, considering that the node have a high update frequency.

I resolve nodejs installation on ubuntu 18.04 Bionic with this task:
sudo vim /etc/apt/sources.list
add this lines:
#newer versions of the distribution.
deb http://fr.archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://fr.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://fr.archive.ubuntu.com/ubuntu/ bionic universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security universe multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ bionic-updates universe multiverse
$sudo apt update
$sudo apt upgrade
$sudo apt install nodejs
$node -v
$sudo apt install npm

Related

install Tizen studio 3.7 on Ubuntu 19.10 or 20.04?

I am stuck on this warning while installing Tizen studio via package manager as it requires a preriquisite:
sudo apt-get install libwebkitgtk-1.0-0
running this command finds nothing. Following askubuntu forum I downloaded bunch of webkitgtk packages from here. Finally I got this error that demonstrates it requires more dependencies.
sudo dpkg -i '/home/rif/Downloads/w/libwebkitgtk-1.0-0_2.4.11-0ubuntu0.1_amd64.deb'
error:
Selecting previously unselected package libwebkitgtk-1.0-0:amd64.
(Reading database ... 156927 files and directories currently installed.)
Preparing to unpack .../libwebkitgtk-1.0-0_2.4.11-0ubuntu0.1_amd64.deb ...
Unpacking libwebkitgtk-1.0-0:amd64 (2.4.11-0ubuntu0.1) ...
dpkg: dependency problems prevent configuration of libwebkitgtk-1.0-0:amd64:
libwebkitgtk-1.0-0:amd64 depends on libjavascriptcoregtk-1.0-0 (= 2.4.11-0ubuntu0.1); however:
Package libjavascriptcoregtk-1.0-0 is not installed.
libwebkitgtk-1.0-0:amd64 depends on libegl1-mesa (>= 7.8.1) | libegl1-x11; however:
...and more stuff not installed, message...
Package libwebkitgtk-1.0-common is not installed.
dpkg: error processing package libwebkitgtk-1.0-0:amd64 (--install):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.31-0ubuntu9) ...
Errors were encountered while processing:
libwebkitgtk-1.0-0:amd64
I have no idea what I should do to install this on Linux. How can I install it Tizen studio on Linux 20.04?
The easiest way to install libwebkitgtk-1.0-0 on Ubuntu 19/20 for now is listed below
echo -e "# For Tizen studio\ndeb http://cz.archive.ubuntu.com/ubuntu bionic main universe" | sudo tee /etc/apt/sources.list.d/tizen-bionic-libwebkitgtk.list
sudo apt update
sudo apt-get install libwebkitgtk-1.0-0
And once the libwebkitgtk-1.0-0 is installed the user might face difficulty in installing libpng12 as well when trying to install any emulators.
Steps to install libpng12 are below
sudo add-apt-repository ppa:linuxuprising/libpng12
sudo apt-get update
sudo apt-get install libpng12-0
After installing the libpng12 & libwebkitgtk-1.0-0 packages, user will be able to install any profile in Ubuntu 19 or Ubuntu 20.
Tizen Studio does not officially support Ubuntu 19 & Ubuntu 20 as of now.
Official support for Ubuntu 20 LTS is expected soon
There is no libwebkitgtk-1.0 for Ubuntu 19.10 or 20.04: https://packages.ubuntu.com/search?keywords=libwebkitgtk-1.0-0
If you want libwebkitgtk-1.0 in Ubuntu 19.10/20.04, you will need to download its source code and try to build (probably with debuild) or install Ubuntu 18.04 in a docker.
Other Tizen tools are not yet officially supported in 19.10 or 20.04.
Or you may contact admins and ask them to add another Ubuntu version support at https://launchpad.net/~tizen.org/+archive/ubuntu/pdk

Installing NodeJS on Ubuntu 16.04 Server with the Package manager installs only the distro version (v.4) instead of LTS

I have this odd problem that when I try to install NodeJS on a fresh Ubuntu Server VM.
I execute the two simple steps from the official instruction but somehow I manage to fail.
In the home directory of my user I execute curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - which ends successfully and then sudo apt-get install -y nodejs but this results in the installation of v.4.2.6.
Output can be seen below:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/3161 kB of archives.
After this operation, 13,2 MB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 97187 files and directories currently installed.)
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.1_amd64.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.1) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Please help.
You probably have to run sudo apt-get update before sudo apt-get install to update the local package lists after adding the sources for 6.x. If you do that, you should see version 6 being installed.
The answer was hiding in this thread: Installing NodeJS on Ubuntu Trusty
So it must have been some kind of an issue with curl using the local network so I used wget to download like this:
wget https://deb.nodesource.com/setup_6.x
And then from the same directory:
sudo bash ./setup_6.x
And finally:
sudo apt-get install nodejs
Which did it.
You might consider using nvm to install Node instead of the distro package. This offers you more flexibility in managing your version of Node.

sudo apt-get-repository: command is not found in debian linux

I was going to install firefox to debian linux. I used ubuntu command
sudo add-apt-repository ppa:mozillateam/firefox-next
but i faced some errors it said
sudo apt-get-repository: command is not found.
So i cannot go forward to install firefox to my debian linux..
Could anyone tell me how to skip this problem and how to install firefox to debian
I suggest you check the Debian version what you're using. Debian by default comes with Iceweasel web browser instead of Firefox.
How to install firefox in Debian Jessie,
Add Mozilla Archive to APT Repositories
Open a terminal as root, and add a new file to /etc/apt/sources.list.d/ directory.
$ touch /etc/apt/sources.list.d/debian-mozilla.list
edit this file in editor, deb http://mozilla.debian.net/ jessie-backports firefox-release
Add the Mozilla Archive Key
This line adds mozilla.debian.net archive to your list of archives. Since the packages at mozilla.debian.net are signed, running apt-get update now will spit out a key not found the error. To add the key you need to download the pkg-mozilla-archive-keyring package, and install it. The package requires that debian-keying package be installed.
commands,
$ cd ~/
$ wget mozilla.debian.net/pkg-mozilla-archive-keyring_1.1_all.deb
$ dpkg -i pkg-mozilla-archive-keyring_1.1_all.deb
Install Firefox, update the archives and install Firefox:
commands,
$ apt-get update
$ apt-get install -t jessie-backports firefox
After doing all the above steps you installed the Firefox.
Installing Firefox browser on Debian wheezy
Edit your /etc/apt/sources.list file and add the following line.
deb http://packages.linuxmint.com debian import
Update your package list.
$ apt-get update
The above command will fetch mint package repository list. As a last step install firefox browser.
$ apt-get install firefox
Debian Jessie and later, another information if you use Jessie then it can be found in the software-properties-common package:
sudo apt-get install software-properties-common
Whereas in Debian Wheezy and earlier, The apt-get program add-apt-repository is available in Debian.
That is located in the package: python-software-properties
sudo apt-get install python-software-properties
Actually, added to that package in version 0.75. The current version in Debian Stable ('squeeze") is 0.60, so it doesn't have it. The version currently in Debian Testing ("wheezy") is 0.82.7.1debian1, so it's available there
I request you to go through this question, it will help you.

Install linux-headers on debian unable to locate package

I am trying to install the linux-headers for my Kernel Version 3.4.61+ and Debian Version 7.1
I typed this Commands:
apt-get update
apt-get install linux-headers-$(uname -r)
On the last command I always get an Error:
E: Unable to locate package linux-headers-3.4.61
E: Couldn't find any package by regex 'linux-headers-3.4.61'
btw: It´s all based on a Cubietruck/Cubieboard3
Here's what you may need to do
sudo apt-get update # This will update the repositories list
sudo apt-get upgrade # This will update all the necessary packages on your system
sudo apt-get dist-upgrade # This will add/remove any needed packages
reboot # You may need this since sometimes after a upgrade/dist-upgrade, there are some left over entries that get fixed after a reboot
sudo apt-get install linux-headers-$(uname -r) # This should work now
You could search first, then choose the closest one.
For example, on my system:
$ apt-cache search linux-headers
linux-headers-3.2.0-4-all - All header files for Linux 3.2 (meta-package)
linux-headers-3.2.0-4-all-amd64 - All header files for Linux 3.2 (meta-package)
linux-headers-3.2.0-4-amd64 - Header files for Linux 3.2.0-4-amd64
So I can install any one of these three.
Heres my experience with this problem:
I installed Kali Linux from a live memory stick. Whilst installing I didn't have an internet connection.
This meant that my sources.list file was set to "Default Off-line Install Values". This meant that when installing I was limited to just the packages and data from the memory stick I Initially installed from.
To fix this, you need to change your sources.list (called switching branches):
Open terminal:
nano /etc/apt/sources.list
This opens the sources file
Now at the top of the file paste in the following two lines:
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
Press CTRL + X then Press Y and Enter to save the file.
Now you can type the following commands to update Kali:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
reboot
And finally, you should now be able to...
sudo apt-get install linux-headers-$(uname -r)
This is just my unique experience with this error stemming from an offline install.
I hope this helps someone else out there.
Reference
Check the Source.list file to contain the repository entries.
You can find them at - https://docs.kali.org/general-use/kali-linux-sources-list-repositories.
After editing the file, save it and run "apt-get update && apt-get upgrade". Now run "apt-get install linux-headers-$(uname -r)"
For latest version of kali linux do the following to install vbox guest additions.
Update the packages
# apt-get update
Command to install virtualbox guest additions
# apt-get install -y virtualbox-guest-x11
Reboot
# reboot
Enjoy!
Now you have successfully installed guest OS additions and you can verify that by toggling full-screen it should now stretch to your screen resolution.
Source: Kali Linux Official (Docs - VirtualBox guest additions)
Just Use:
sudo apt-get install linux-headers-generic
if you are on a Desktop installation. The apt-get will solve the dependencies and install the correct version of kernel headers.

VirtualBox Warning: program compiled against libxml 209 using older 207

I have installed Ubuntu Server 12.04-4 LTS.
Set to /etc/apt/sources.list
deb http://download.virtualbox.org/virtualbox/debian saucy contrib
deb http://download.virtualbox.org/virtualbox/debian raring contrib
deb http://download.virtualbox.org/virtualbox/debian quantal contrib
deb http://download.virtualbox.org/virtualbox/debian precise contrib
deb http://download.virtualbox.org/virtualbox/debian lucid contrib non-free
deb http://download.virtualbox.org/virtualbox/debian wheezy contrib
deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free
After that I did
sudo apt-get update
sudo apt-get install virtualbox-4.3
The Commandline below give me the Error
"Warning: program compiled against libxml 209 using older 207"
VBoxManage setproperty websrvauthlibrary null
Than I downloaded the install the Extension Pack of Linux
wget http://download.virtualbox.org/virtualbox/VERSION/Oracle_VM_VirtualBox_Extension_Pack-4.3.6.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.6.vbox-extpack
Got the same error like above with "Warning: program compiled against libxml 209 using older 207"
Can anybody tell what is wrong? What is wrong with libxml?
ScreenLog
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.0.vbox-extpack
Warning: program compiled against libxml 209 using older 207
0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to install "/home/thatsme/Oracle_VM_VirtualBox_Extension_Pack-4.3.0.vbox-extpack"
VBoxManage: error: The installer failed with exit code 127: Warning: program compiled against libxml 209 using older 207
VBoxManage: error: Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ExtPackManager, interface IExtPackManager
VBoxManage: error: Context: "int handleExtPack(HandlerArg*)" at line 1143 of file VBoxManageMisc.cpp
Warning: program compiled against libxml 209 using older 207
It seems to be a warning and not an error so you don't have to take it so seriously :)
Besides, in your sources.list you should not be putting those extra repo since with 12.04 (precise) you should be ok. Those extra repos can cause a lot of trouble and interdependency problems if you don't take care.
So, I recommend you to only left your sources.list with the only needed for your distribution:
deb http://download.virtualbox.org/virtualbox/debian precise contrib
Also, you can try to do a package upgrade with sudo apt-get update or sudo apt-get dist-upgrade to see if the version issue dissapear with a libxml upgrade.
Also, you can try to force an update on libxml by issuing sudo apt-get install libxml to see if that solves your warning.
HTH
Are you installing the Extension Pack on the Host system or on the (Virtual) guest system? What is your Host system, assuming Ubuntu-server is the guest OS?
FYI: It should be installed on the Host system, and your regular username thatsme should be added to the vboxusers group
sudo usermod -aG vboxusers thatsme
As for the libxml errors, they should be harmless; feel free to check out this thread on the virtualbox forums, where a user has similar issues.

Resources