User Tools

Site Tools


ubuntu:install_node.js

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ubuntu:install_node.js [2019/12/05 01:10] peterubuntu:install_node.js [2021/01/25 10:47] (current) peter
Line 1: Line 1:
 ====== Ubuntu - Node.js - Install node.js ====== ====== Ubuntu - Node.js - Install node.js ======
  
-===== Install packages required to compile the source code ===== +[[Ubuntu:Install node.js:Install from Source|Install from Source]]
- +
-<code bash> +
-sudo apt install build-essential +
-</code>+
  
 ---- ----
  
-===== Download the latest source code from nodejs.org =====+===== Update your system =====
  
 <code bash> <code bash>
-wget http://nodejs.org/dist/v0.10.9/node-v0.10.9.tar.gz+sudo apt-get update 
 +sudo apt-get install git-core curl build-essential openssl libssl-dev python
 </code> </code>
  
 ---- ----
  
-===== Extract the tar archive =====+===== Install Node.js ===== 
 + 
 +==== Clone the Node.js repository: ====
  
 <code bash> <code bash>
-tar zxvf node-v0.10.9.tar.gz+git clone https://github.com/nodejs/node.git 
 +cd node
 </code> </code>
  
----- +<WRAP info> 
- +**NOTE:**  If you require a specific version of Node:
-===== Enter the directory we just extracted from the tar archive =====+
  
 <code bash> <code bash>
-cd node-v0.10.9+git tag # Gives you a list of released versions 
 +git checkout v13.10.1
 </code> </code>
  
-----+</WRAP>
  
-===== Compile and install =====+ 
 +==== Compile and install Node ====
  
 <code bash> <code bash>
 ./configure ./configure
 make make
-make install+sudo make install
 </code> </code>
  
-----+<WRAP info> 
 +**NOTE:**  This might take a while, depending on your hardware. 
 +</WRAP>
  
-===== Test ===== 
  
-Test node.js to make sure it’s working correctly.+==== Check if node was installed correctly ====
  
 <code bash> <code bash>
-echo "console.log('Hello World');"node+node -v
 </code> </code>
  
-This should simply print “Hello World” in the console.+----
  
-If you don’t get any errorsnode.js is installed and functional and you may just have executed your first node.js script.+===== Install NPM ===== 
 + 
 +<code bash> 
 +curl -L https://npmjs.org/install.sh | sudo sh 
 +</code> 
 + 
 +<WRAP important> 
 +**WARNING:**  Running a script directly from the web can be dangerousas it may contains trojans. 
 + 
 +Instead, you may want to download the script, and then review the contents before actually installing it. 
 + 
 +</WRAP> 
 + 
 +---- 
 + 
 +==== Test ==== 
 + 
 +<code bash> 
 +npm -v 
 + 
 +</code>
  
ubuntu/install_node.js.1575508253.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki