Problem installing node js and npm on Manjaro linux - node.js

OS: Manjaro
I installed npm and nodejs by this command: sudo pacman -S nodejs npm
after installation i have an error:
~]$ npm -v
node: error while loading shared libraries: libicui18n.so.67: cannot open shared object file: No such file or directory
~]$ node --version
node: error while loading shared libraries: libicui18n.so.67: cannot open shared object file: No such file or directory
How can i solve this problem?

Install nvm (Node Version Manager)
yay -S nvm
Load nvm
source /usr/share/nvm/init-nvm.sh
You can also add the above line in your environment file such as .bashrc so you won’t have to do it every time.
Install Node.js and npm
nvm -g install npm
Test your setup – open a new terminal and install a package using npm
$ nvm use stable
$ nvm -g install browser-sync
$ browser-sync start --server

I found that you need to install both nodejs and npm from the package manager. If you first install npm however, node is automatically installed as a dependency.
yay -S npm

Installing:
pamac install nodejs
pacman -S nodejs
refer : https://discover.manjaro.org/packages/nodejs

Related

Installing latest version of npm on Ubuntu 14.04 (trusty)

I have
a remote serving running Ubuntu 14.04. I used apt to install node
a local OSx machine running El Capitan. I used hombrew to install node.
This results in the following.
Ubuntu 14.04
> sudo apt-get update
> sudo apt-get install node nodejs npm
> npm --version
1.3.10
> node --version
(emtpy)
> nodejs --version
v0.10.25
OSx
> brew install node
> npm --version
5.6.0
> nodejs --version
-bash: nodejs: command not found
> node --version
v8.11.3
Why are the apt repositories so out of date? The npm version on the server (1.3.10) is 4 versions behind that of OSx machin (5.6.0).
This npm issue even mentions that the apt repositories are quite old / not updated.
Is there a way to install a more recent version of npm on the Ubuntu server?
Download this tar file from nodejs official website
https://nodejs.org/dist/v8.11.4/node-v8.11.4.tar.gz
download, untar and install it via using the following command
sudo make test
sudo make install
It will install 8.11.4 version.
Please note that you can download any version of tar from nodejs officail page and can install it on your Ubuntu server and by using this method you don't need to update your apt packages.

sudo npm i npm or sudo npm install npm#latest -g throws an error of EACCES:permission denied

I have npm v 5.6 and I installed node version 10.1 so the current npm doesn't support node version while updating npm I am getting EACCES permission denied error. I tried removing npm directory and updating via several command the npm version is stuck at 5.6. Help!!
Using Ubuntu v16.04 LTS.
I tried installing different nodejs version too but it also doesnt change npm version(npm v5.6).
visit here for the screenshot
I'd recommend using a version manager (such as nvm) to install multiple versions of Node.js and switch between them at will.
First off, make sure you have git and the build-essential package installed:
sudo apt-get update
sudo apt-get install build-essential git
Then install nvm with cURL (run this command in your terminal):
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
This will clone the nvm repository to ~/.nvm and will make the required changes to your bash profile, so that nvm is available from anywhere in your terminal.
Reload your bash profile:
source ~/.bashrc
and verify the install by typing:
command -v nvm
which should output 'nvm' if the installation was successful.
(if this doesn't work, just close, then reopen your terminal)
And that’s it, nvm is installed and ready to be used.
Now, to download, compile, and install the latest release of Node, run the following from your terminal:
nvm install node
And then in any new shell just use the installed version:
nvm use node
Finally, verify the correct version is being used:
node -v
=> 10.5.0
There's a lot more to using nvm, such as installing multiple Node versions.
You can read more about that here: https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/
HTH

How do I find the old version of node js?

I'm trying to install "n", the nom helper on Amazon Linux. I'm having difficulty. It seems I have an old version of the node somewhere but I can't figure out where. When I run
npm install -g n
I get the below error ...
[myuser#mymachine ~]$ sudo /usr/local/bin/npm install -g n
ERROR: npm is known not to run on Node.js v0.10.48
You'll need to upgrade to a newer version in order to use this
version of npm. Supported versions are 4, 6, 7, 8. You can find the
latest version at https://nodejs.org/
[myuser#mymachine ~]$ npm -v
5.4.2
╭─────────────────────────────────────╮
│ │
│ Update available 5.4.2 → 5.5.1 │
│ Run npm i -g npm to update │
│ │
╰─────────────────────────────────────╯
But notice that when I run
[myuser#mymachine ~]$ node -v
v8.8.1
it tells me I have v8.8.1 installed, which is what I intended. How do I purge the old, unwanted version of the node so I can install my helper?
Easiest solution would be to try the following to cleanup your node issues and reinstall a clean version.
First remove everything related to node
sudo apt-get purge --auto-remove nodejs npm
UPDATE For yum:
yum clean all
yum -y remove nodejs
Remove these leftover files and folders as well
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules
Then install node back with nvm,
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
//To uninstall a node version
//nvm uninstall <current version>
nvm install 8.8.1
nvm use 8.8.1
//check with
node -v
npm -v
//**UPDATE**: Install your package
npm install -g n
And all should work.
UPDATE : Install Without NVM
yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -
yum install nodejs
node -v
//Install your package
npm install -g n
check the releases notes of node https://nodejs.org/en/download/releases/ you can download older version from this site
An alternative to installing Node.js through apt is to use a specially designed tool called nvm, which stands for "Node.js version manager".
Using nvm, you can install multiple, self-contained versions of Node.js which will allow you to control your environment easier. It will give you on-demand access to the newest versions of Node.js, but will also allow you to target previous releases that your app may depend on.
To start off, we'll need to get the software packages from our Ubuntu repositories that will allow us to build source packages. The nvm script will leverage these tools to build the necessary components:
sudo apt-get update
sudo apt-get install build-essential libssl-dev
Once the prerequisite packages are installed, you can pull down the nvm installation script from the project's GitHub page. The version number may be different, but in general, you can download it with curl:
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
And inspect the installation script with nano:
nano install_nvm.sh
Run the script with bash:
bash install_nvm.sh
It will install the software into a subdirectory of your home directory at ~/.nvm. It will also add the necessary lines to your ~/.profile file to use the file.
To gain access to the nvm functionality, you'll need to log out and log back in again, or you can source the ~/.profile file so that your current session knows about the changes:
source ~/.profile
Now that you have nvm installed, you can install isolated Node.js versions.
To find out the versions of Node.js that are available for installation, you can type:
nvm ls-remote
Output
...
v5.8.0
v5.9.0
v5.9.1
v5.10.0
v5.10.1
v5.11.0
v6.0.0
As you can see, the newest version at the time of this writing is v6.0.0. You can install that by typing:
nvm install 6.0.0
Usually, nvm will switch to use the most recently installed version. You can explicitly tell nvm to use the version we just downloaded by typing:
nvm use 6.0.0
When you install Node.js using nvm, the executable is called node. You can see the version currently being used by the shell by typing:
node -v
Output
v6.0.0
If you have multiple Node.js versions, you can see what is installed by typing:
nvm ls
If you wish to default one of the versions, you can type:
nvm alias default 6.0.0
This version will be automatically selected when a new session spawns. You can also reference it by the alias like this:
nvm use default
Each version of Node.js will keep track of its own packages and has npm available to manage these.

Uninstalling / Removing npm and node package on Mac

I am trying to remove the package download of npm and node that I installed to install them with Homebrew instead. However I am having great difficulty in doing this. How can I get the package version of node.js and npm totally removed from my Mac so I can install the Homebrew version?
Note: I have tried sudo npm rm --global node however I get the error sudo: npm: command not found
check the link below for uninstalling node/npm
How do I uninstall nodejs installed from pkg (Mac OS X)?
and the brew error is happening due to permmision issue.
Since brew basically don't allow to be executed with sudo so change the directory permission before brew command.
changing permission:
sudo chown -R $USER:admin /usr/local
brew link command:
brew link node
and then you can use npm or node commands.

bash commandline jslint wont scan file and wont give an error

Why wont my jslint scan a file in bash?
On a fresh install of kubuntu
I installed node
sudo apt-get install node
Then
sudo apt-get install npm
Then
sudo npm install jslint -g
All installs worked well with no errors
my issue comes when I type: I use tab to auto complete
a#a:~/Desktop$ jslint test.js
a#a:~/Desktop$
it does nothing just creates a new line why? the file clearly has errors
PS proof it all installed
a#a:~/Desktop$ nodejs -v
v0.10.25
a#a:~/Desktop$ npm -v
1.3.10
The issue was that I had installed node and not nodejs as they are two different thing
sudo apt-get install nodejs

Resources