Skip to content

Instantly share code, notes, and snippets.

@dwayne
Last active January 12, 2024 17:48
Show Gist options
  • Save dwayne/2983873 to your computer and use it in GitHub Desktop.
Save dwayne/2983873 to your computer and use it in GitHub Desktop.
Installing node and npm on Ubuntu 12.04 LTS and 64-bit Ubuntu 14.04 LTS.
  1. Navigate to http://nodejs.org/download/ and on the Linux Binaries (.tar.gz) row click to download the 64-bit version of the current latest release.

  2. Say you've downloaded node-v0.10.7-linux-x64.tar.gz into the Downloads directory. Then, open the terminal and type the following:

$ cd ~/Downloads
$ mkdir -p ~/local/node
$ tar xzf node-v0.10.7-linux-x64.tar.gz -C ~/local/node --strip-components=1
$ echo '# Node Enviroment Setup' >> ~/.bashrc
$ echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.bashrc
$ echo 'export NODE_PATH=$HOME/local/node/lib/node_modules' >> ~/.bashrc
$ . ~/.bashrc
  1. No step 3. That's it.

Assumes a fresh install of Ubuntu 12.04 LTS.

  1. Setup the system to handle compiling and installing from source.

     $ sudo apt-get install build-essential
    
  2. If SSL support is needed then we will need to install libssl-dev.

     $ sudo apt-get install libssl-dev
    
  3. The install script uses curl, so we will need to install curl.

     $ sudo apt-get install curl
    
  4. Change into the directory containing the install script and source it.

     $ . node-and-npm-in-30s.sh
    

    N.B. This step takes a while.

  5. Finally, check that the latest version of node and npm are indeed installed.

     $ node -v
     $ npm -v
    

References:

# The install script
# Adapted from https://gist.github.com/579814
echo '# Added by install script for node.js and npm in 30s' >> ~/.bashrc
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
echo 'export NODE_PATH=$HOME/local/lib/node_modules' >> ~/.bashrc
. ~/.bashrc
mkdir -p ~/local
mkdir -p ~/Downloads/node-latest-install
cd ~/Downloads/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local # if SSL support is not required, use --without-ssl
make install # ok, fine, this step probably takes more than 30 seconds...
@delbao
Copy link

delbao commented Nov 18, 2017

I got

In file included from ../deps/icu-small/source/common/unicode/uniset.h:17:0,
                 from ../deps/icu-small/source/common/bmpset.cpp:20:
../deps/icu-small/source/common/unicode/unistr.h: In constructor ‘icu_60::UnicodeString::UnicodeString(const uint16_t*)’:
../deps/icu-small/source/common/unicode/unistr.h:3014:7: error: type ‘icu_60::UnicodeString’ is not a direct base of ‘icu_60::UnicodeString’
../deps/icu-small/source/common/unicode/unistr.h: In constructor ‘icu_60::UnicodeString::UnicodeString(const uint16_t*, int32_t)’:
../deps/icu-small/source/common/unicode/unistr.h:3076:7: error: type ‘icu_60::UnicodeString’ is not a direct base of ‘icu_60::UnicodeString’
../deps/icu-small/source/common/unicode/unistr.h: In constructor ‘icu_60::UnicodeString::UnicodeString(uint16_t*, int32_t, int32_t)’:
../deps/icu-small/source/common/unicode/unistr.h:3169:7: error: type ‘icu_60::UnicodeString’ is not a direct base of ‘icu_60::UnicodeString’
make[1]: *** [/mnt/home/dbao/Downloads/node-latest-install/out/Release/obj.target/icuucx/deps/icu-small/source/common/bmpset.o] Error 1
rm 8fb62512c38147a744d80ecf8537e076f16e1315.intermediate
make[1]: Leaving directory `/mnt/home/dbao/Downloads/node-latest-install/out'
make: *** [node] Error 2

@GlassUp
Copy link

GlassUp commented Nov 23, 2017

Same error here on a Pandaboard with Ubuntu 12.04:

In file included from ../deps/icu-small/source/common/unicode/uniset.h:17:0,
from ../deps/icu-small/source/common/bmpset.cpp:20:
../deps/icu-small/source/common/unicode/unistr.h: In constructor ‘icu_60::UnicodeString::UnicodeString(const uint16_t*)’:
../deps/icu-small/source/common/unicode/unistr.h:3014:7: error: type ‘icu_60::UnicodeString’ is not a direct base of ‘icu_60::UnicodeString’
../deps/icu-small/source/common/unicode/unistr.h: In constructor ‘icu_60::UnicodeString::UnicodeString(const uint16_t*, int32_t)’:
../deps/icu-small/source/common/unicode/unistr.h:3076:7: error: type ‘icu_60::UnicodeString’ is not a direct base of ‘icu_60::UnicodeString’
../deps/icu-small/source/common/unicode/unistr.h: In constructor ‘icu_60::UnicodeString::UnicodeString(uint16_t*, int32_t, int32_t)’:
../deps/icu-small/source/common/unicode/unistr.h:3169:7: error: type ‘icu_60::UnicodeString’ is not a direct base of ‘icu_60::UnicodeString’
make[1]: *** [/mnt/home/dbao/Downloads/node-latest-install/out/Release/obj.target/icuucx/deps/icu-small/source/common/bmpset.o] Error 1
rm 8fb62512c38147a744d80ecf8537e076f16e1315.intermediate
make[1]: Leaving directory `/mnt/home/dbao/Downloads/node-latest-install/out'
make: *** [node] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment