2

I am not able to install node-v8.2.1-linux-x64.tar.xz in my Ubuntu 16.04.

I am installing node via source - I do not want an apt solution as per:

How to install NodeJS 4 using apt?

Message I am getting:-

npm WARN saveError ENOENT: no such file or directory, open 
'/home/ubuntuser/Downloads/node-v8.2.1-linux-x64/lib/package.json'
npm WARN enoent ENOENT: no such file or directory, open 
'/home/vishnu/Downloads/node-v8.2.1-linux-x64/lib/package.json'
npm WARN lib No description
npm WARN lib No repository field.
npm WARN lib No README data
npm WARN lib No license field.

Can anybody post the step by step installation process?

0

2 Answers 2

1

You can use nvm - node version manager:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
nvm install v8.2.1

Test with node -v :)

8
  • node -v working , nodejs -v displays program not installed why?
    – mevr
    Commented Aug 9, 2017 at 13:09
  • You will need to create a link: sudo ln -s /usr/bin/nodejs /usr/bin/node, see stackoverflow.com/questions/18130164/…
    – ponsfrilus
    Commented Aug 9, 2017 at 13:12
  • Ok, thanks.How can i uninstall node?I have tried this sudo apt-get purge --auto-remove node but not working
    – mevr
    Commented Aug 9, 2017 at 13:18
  • See stackoverflow.com/a/41429093/960623: sudo apt-get purge node; sudo apt autoremove
    – ponsfrilus
    Commented Aug 9, 2017 at 13:19
  • I tried uninstalling , Am facing this error now : nvm install v8.2.1 v8.2.1 is already installed. /usr/bin/env: ‘node’: No such file or directory nvm is not compatible with the npm config "prefix" option: currently set to "" Run npm config delete prefix or nvm use --delete-prefix v8.2.1 to unset it.
    – mevr
    Commented Aug 9, 2017 at 13:37
0

I created below bash script to install nodejs ... no need to wait for nvm to make latest release available ... cat install_node.sh

#!/bin/bash

# ............... top of cut  ........................  install_node.sh

# export NODE_VER=v8.0.0 # matches meteor 1.4.2.3 # edit this line next time you need to update nodejs
export NODE_VER=v8.2.1

# pick parent dir of nodejs install  ... comment out or remove ONE of below
# export CODE_PARENT_DIR=/opt/code  # root owned dir ... requires you to sudo prior to npm install going forward
export CODE_PARENT_DIR=${HOME}    # RECOMMENDED

# ......... following env vars are OK no edits needed

curr_OS=$( uname )

echo curr_OS $curr_OS

if [[ "${curr_OS}" == "Darwin" ]]; then

    export OS_ARCH=darwin-x64

elif [[ "${curr_OS}" == "Linux" ]]; then

    export OS_ARCH=linux-x64
else
    echo "ERROR - failed to recognize OS $curr_OS"
    exit 5
fi

if [[ -z ${CODE_PARENT_DIR} ]]; then

    echo "ERROR - failed to see env var CODE_PARENT_DIR"
    exit 5
fi

export NODE_CODEDIR=${CODE_PARENT_DIR}/nodejs
export COMSUFFIX=tar.gz
export NODE_NAME=node-${NODE_VER}
export NODE_PARENT=${NODE_CODEDIR}/${NODE_NAME}-${OS_ARCH} 

export PATH=${NODE_PARENT}/bin:${PATH}
export NODE_PATH=${NODE_PARENT}/lib/node_modules

# ............... end of cut  ........................  install_node.sh

# put all above export lines into  ~/.bashrc file 

echo
echo "NODE_CODEDIR $NODE_CODEDIR<--"
echo

echo "mkdir -p ${NODE_CODEDIR}"
echo
      mkdir -p ${NODE_CODEDIR}
echo

echo "cd ${NODE_CODEDIR}"
      cd ${NODE_CODEDIR}
echo

# this is compiled code NOT source

[ -f ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX} ] && rm ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX} # if file exists remove

echo "wget -q --show-progress https://nodejs.org/download/release/${NODE_VER}/${NODE_NAME}-${OS_ARCH}.${COMSUFFIX}"
      wget -q --show-progress https://nodejs.org/download/release/${NODE_VER}/${NODE_NAME}-${OS_ARCH}.${COMSUFFIX}
echo

echo "tar -C ${NODE_CODEDIR} -xf ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX}"
      tar -C ${NODE_CODEDIR} -xf ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX}
echo

[ -f ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX} ] && rm ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX} # if file exists remove

# ...........  done ........... #

which node

node --version

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .