pidora nodejs is resulting an error - node.js

I'm getting this below error when trying to use nodes on my PI with fedora variant of OS.
ERROR: Binary compiled with -mfloat-abi=hard but without -DUSE_EABI_HARDFLOAT
nodeJS version --> v0.10.25, installed via "yum install nodejs"
nodeJS version --> v0.11.9, downloaded from "http://nodejs.org/dist/v0.11.9/" also gives the same error.
any clue on how i can get pass this?
I was able to use the downloaded copy of "node-v0.10.19-linux-arm-pi" with out an error.
Thanks,
-Vikas.

I had the same issue, and I couldn't compile npm at all, so I did what you suggested:
wget http://nodejs.org/dist/v0.10.5/node-v0.10.5-linux-arm-pi.tar.gz
cd /usr/local
sudo tar xzvf ~/node-v0.10.5-linux-arm-pi.tar.gz --strip=1
echo "export PATH=$PATH:/usr/local/bin/node" > ~/.bash_aliases
bash
node -v
v0.10.5
npm -v
1.2.18
Hope this would be useful for somebody else ;-)

Related

Rookie error with Node.js, Johnny Five and Raspbian

I'm currently trying to communicate with Arduino through a web server created with Node.js installed on my Orange PI PC. In order to do this, I tried to use the module called johnny five, but the only output I receive is a bunch of errors.
I'm using Raspbian v0.8.0 for Orange PI PC.
I installed node v0.10.0 by using wget plus the link.
Then, I unpacked the file by using:
cd /usr/local
sudo tar xzvf ~/node-v0.10.0-linux-arm-pi.tar.gz --strip=1
The version of node is 0.10.0 and the NPM's version is 1.2.14. When I tried to update the npm with the command npm install npm -g
these errors came in
Then, I tried to install johnny-five by following the guide that I've found on the johnny-five website which is linked to Github
And this happened
If I try to run a program, many error appear saying at the top of them 'cannot find module johnny five'.
This version of node is the only one that works for me after checking many other of them.
Try and set up a more advanced version of node.js. I had success with node v4. This will update NPM/Node.
# install updates
sudo apt-get update && sudo apt-get upgrade
# install node
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
# test
node -v
npm -v
# clone the code of the project in a folder and continue normally
You can find an old version in the Heroku web:
https://node-arm.herokuapp.com/
But if you want a more recent go to https://nodejs.org/en/download/ and dowload a new one from Linux Binaries (ARM). Unzip the binary archive to any directory you wanna install Node, I use /usr/lib/nodejs:
sudo mkdir /usr/lib/nodejs
sudo tar -xJvf node-v8.9.4-linux-armv7l.tar.xz -C /usr/lib/nodejs
sudo mv /usr/lib/nodejs/node-v8.9.4-linux-armv7l /usr/lib/nodejs/node-v8.9.4
Set the environment variable ~/.profile, adding below to the end:
# Nodejs
export NODEJS_HOME=/usr/lib/nodejs/node-v8.9.4
export PATH=$NODEJS_HOME/bin:$PATH
Refresh profile:
.~/.profile
Test installation using:
node -v
and
npm version

Unable to install global modules using sudo npm

I was trying to install pm2, sails.js for Node.js from a non-root user with sudo. I get the below error:
sudo npm install pm2 -g
sudo: npm: command not found
but when i try to install using the below command, it works
sudo /usr/local/bin/npm install pm2 -g
How can i make sudo npm work?
Thanks.
How i installed Node and npm with su previously:
su -
yum install gcc-c++ openssl-devel python
cd /usr/local/src
wget http://nodejs.org/dist/node-latest.tar.gz
tar zxvf node-latest.tar.gz
(cd into extracted folder: ex "cd node-v0.10.3")
./configure
make
make install
It means the npm is not install with sudo, so it is not in the path of root. I think, it is better to always use npm without 'sudo'. Because you can keep the packaged installed with npm in your local environment.
If you really want to use with sudo, you can re-install node with sudo.
Yes, NPM is not installed on your system.
you can check first if node is set perfectly.
$node -v
it will give version.
if yes then check
$npm -v
if its not giving version may be your environment path is not set then execute
$PATH=/usr/bin/node:$PATH
and just check node -v and npm -v . if npm gives version number. thats it. It will install global package.
A big thanks to everyone who helped me out! Just like #Rodrigo Medeiros advised me, i installed node.js and npm using the below method taken from (https://gist.github.com/isaacs/579814#file-take-ownership-sh) but modified two lines of commands as per the advise from a comment posted by deesejohn in that page.
cd
sudo yum install gcc-c++
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=$HOME/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl -L https://www.npmjs.org/install.sh | sh
Check installed version using node -v and npm -v
Now, i am able to install npm modules globally without sudo permissions, there are many ways to install node.js and npm but this worked for me.
Thanks.

Node and NVM install broken on Ubuntu 14. Any ideas what I should do?

which node
returns
/usr/sbin/node
which nvm
returns nothing
nvm ls returns nothing
express no longer works
If I try curl https://raw.githubusercontent.com/creationix/nvm/v0.11.1/install.sh | bash
It says
nvm is already installed in /home/adam/.nvm, trying to update
=> HEAD is now at 7a423b7... v0.11.1
error: branch 'master' not found.
and it is true that .nvm is located there.
Any idea what I should do to either uninstall everything and reinstall it or fix my install?
The problem is that apt-get install nodejs installs node as "nodejs" on your path. Grunt, express, etc. all expect node to be node on your path. The reason for this is there was a package named node already in the Ubuntu apt repository before node.js came into existence, so node.js couldn't claim "node". The simplest solution is to do which nodejs then create a symlink targeting that file, name it node, and put that on your path (you can just put it in the same directory).
For you I recommend uninstalling everything first (apt-get remove).
I fixed this by deleting everything (purge Ubuntu packages and delete everything created by node and npm in /usr/*) and compiling the node package from their website.
I copied the commands from https://www.digitalocean.com/community/tutorials/how-to-install-an-upstream-version-of-node-js-on-ubuntu-12-04 instead of linking, in case the site goes offline:
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install
curl -L https://npmjs.org/install.sh | sh
node -v
The unofficial install scripts are buggy and it's about time they make an official repository or pre-compile some .deb files to make the installation easier. Hope this helps.

Building Node.js gives error: Node.js configure error: No acceptable C compiler found

While trying to use a Ubuntu 14.04 system to cross compile Node.js v0.10.30 for ARM (Raspberry Pi B), I'm experiencing an error message:
Node.js configure error: No acceptable C compiler found!
Please make sure you have a C compiler installed on your system and/or
consider adjusting the CC environment variable if you installed
it in a non-standard prefix.
How should I fix this problem and compile node.js successfully?
Commands used on a fresh Ubuntu 14.04 x64 installation:
sudo apt-get install gcc g++ git
git clone git://github.com/joyent/node.git
cd node
git checkout v0.10.30-release
export AR=arm-unknown-linux-gnueabi-ar
export CC=arm-unknown-linux-gnueabi-gcc
export CXX=arm-unknown-linux-gnueabi-g++
export LINK=arm-unknown-linux-gnueabi-g++
./configure --without-snapshot --dest-cpu=arm --dest-os=linux
I ran into this error as well after trying to run ./configure in my node directory. Here are the commands I ran to get node working for me on an ubuntu server:
cd .. (back to directory where node directory was created)
sudo apt-get install build-essential
cd node/
./configure
make (For relative newbies, like me, this step took awhile to complete, so don't freak out too much if that happens for you)
sudo make install
Then try running your node file from it's directory. As a small aside, I also got the following error when doing that:
Error: ENOENT, stat '/home/ubuntu/local'
at Error (native)
To fix that, I just ran: sudo npm install -g npm
I was required to use: sudo apt-get install npm -g -y in my WSL, VSCode Windows terminal.

Installing NPM on AWS EC2

Working on Ec2 on AWS.
I have installed Node.js and it works fine.
But the problem arises when trying to install npm.
I am using the following command to install it:
sudo curl http://npmjs.org/install.sh | sh
But the install seems to freeze...
I get "fetching: http://registry.npmjs.org/npm/-/npm-1.0.106.tgz" at the prompt and it stays on like this.
Have any idea what is going on here?
sudo yum install nodejs npm --enablerepo=epel
Follow this AWS Tutorial that uses Node Version Manager.
Node Version Manager (NVM) lets you install multiple versions of Node.js and switch between them.
Here are the steps:
Install NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
Activate NVM
. ~/.nvm/nvm.sh
Install Node (choose version)
nvm install 15.0.0
Confirm Successful Installation
node -e "console.log('Running Node.js ' + process.version)"
To install NodeJS 6.x execute the following commands:
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
yum install nodejs --enablerepo=nodesource
Update
You can install NodeJS 7 and 8 in the same way. Just specify the version you need instead of 6 in the command above.
Update
To update to NodeJS 16 (or any other version) do the following:
rm -rf /etc/yum.repos.d/nodesource-el*
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
yum install nodejs --enablerepo=nodesource
Simplest way to install npm/nodejs on Amazon Linux 2 ec2 isntance:
First install epel repo using amazon-linux-extras command as below:
sudo amazon-linux-extras install epel
Now install npm and nodejs as below:
sudo yum install nodejs npm
you can verify the version of node and npm as below:
node -v
npm -v
PS. I've tested this on Amazon Linux 2 AMI (HVM) ec2 instance.
This guide worked perfectly: https://tecadmin.net/install-latest-nodejs-amazon-linux/
Make sure you have make
# sudo yum install -y gcc-c++ make
Install source
# curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash -
Install node
# sudo yum install -y nodejs
Note - you'll have to run sudo npm install to get the installs to work.
Firstly
sudo yum install make
You can run this to get zip of desired version of node
wget https://nodejs.org/dist/v8.10.0/node-v8.10.0.tar.gz
Then you can unzip it like this
tar -xvf node-v8.10.0.tar.gz
then go in to the extracted directory and install node like this
./configure && make && sudo make install
I found his tutorial that has been very usefull to me: The last chapter explains how to install node and npm compiling it.
http://iconof.com/blog/how-to-install-setup-node-js-on-amazon-aws-ec2-complete-guide/#installNode
Get the http://npmjs.org/install.sh file on your system first and then execute it directly instead of piping with curl.
Use chmod +x install.sh to make it executable
Then run ./install.sh
I did it manually. Why mess with installers that break or don't put things where I want them? Such were the problems encountered while installing *node.js" on Amazon Web Services, that a manual install was the easy way to get the result I wanted.
I want a GLOBAL install of node and npm on AWS. By that I mean install should be put in a place like /usr/bin, so that all users have access. Surprisingly, AWS apparently doesn't give support to that idea. AWS encourages using nvm, node version manager, but that seems to always install in a user directory, and not a system level directory. After being frustrated when the "rpm" solutions (mentioned elsewhere) failed, I finally decided to just do the installation manually.
In a browser, go to nodejs.org download page:
https://nodejs.org/en/download/
Find a link that says:
All download options
Click through that; it goes to an index page with a URL like:
https://nodejs.org/dist/v14.16.1/
There I looked for the name that had "linux" and "x86" in the name.
I wrote this down, or select-and-copied, to get the correct spelling.
In my case it was:
node-v14.16.1-linux-x64.tar.gz
Putting the two parts together, I got the following URL:
https://nodejs.org/dist/v14.16.1/node-v14.16.1-linux-x64.tar.gz
So that's what is to be downloaded using curl.
I have a "temp" directory conveniently located in my home dir.
cd ~/temp
The download was accomplished with "curl". Note that the -o option was used to give the output file the name of my choosing. Of course, I chose to give it the same name as the web site file.
curl -o node-v14.16.1-linux-x64.tar.gz https://nodejs.org/dist/v14.16.1/node-v14.16.1-linux-x64.tar.gz
Untar the downloaded file.
tar xf node-v14.16.1-linux-x64.tar.gz
Conveniently, it creates its own directory. Go there.
cd node-v14.16.1-linux-x64 || exit 1;
Observe that the delivery consists of a relatively small number of files and directories (since node_modules is dealt with as a unit).
In my case, I had an old and bad implementation still installed, so the following commands were used to move aside any junk that might happen to be in the way. Some commands errored out because the old junk didn't exist. That's ok, error while moving to -OLD just means there is nothing to move; which is good.
Note: I put all these mv (move) commands into a script file, made it executable, and ran it as sudo. The alternative is to run each line individually as sudo.
mv /usr/bin/node /usr/bin/node-OLD
mv /usr/bin/npm /usr/bin/npm-OLD
mv /usr/bin/npx /usr/bin/npx-OLD
mv /usr/include/node /usr/include/node-OLD
mv /usr/lib/node_modules /usr/lib/node_modules-OLD
mv /usr/share/doc/node /usr/share/doc/node-OLD
mv /usr/share/man/man1/node.1 /usr/share/man/man1/node.1-OLD
mv /usr/share/systemtap/tapset/node.stp /usr/share/systemtap/tapset/node.stp-OLD
An here is the actual install. Remember, this is occurring in the untarred directory, in my case node-v14.16.1-linux-x64.
mv bin/node /usr/bin
mv bin/npm /usr/bin
mv bin/npx /usr/bin
mv include/node /usr/include
mv lib/node_modules /usr/lib
mv share/doc/node /usr/share/doc
mv share/man/man1/node.1 /usr/share/man/man1
mv share/systemtap/tapset/node.stp /usr/share/systemtap/tapset/
That's it, all finished.
Latest version 18 has dependency I think..
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
Finally I got solution by running by running following commands.
sudo apt-get remove nodejs
nvm install 16.15.1
v16.15.1 node version and npm v v16.15.1 is installed.
For same make sure nvm is installed in your machine.
This works for me:
sudo apt install npm
Edit as my answer wasn't pertinent anymore:
Try:
curl --silent --location https://rpm.nodesource.com/setup | bash -
yum -y install nodejs
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#enterprise-linux-and-fedora-core

Resources