0507.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Install NodeJS on Armbian</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="NodeJS,Armbian,SBC,Single Board Computer,Raspberry Pi Alternative,Amlogic,Development,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Install NodeJS on Armbian">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="06/16/2022 03:26:09 PM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Install NodeJS on Armbian</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>What is NodeJS</h2>
  26. <p><em>Node.js is an open-source, cross-platform, JavaScript runtime environment. It executes JavaScript code outside of a browser.</em> -<a href="https://github.com/nodejs/node" target="_blank">https://github.com/nodejs/node</a></p>
  27. <h2>Installing NodeJS</h2>
  28. <ol>
  29. <li>Log into the Armbian device</li>
  30. <li>Run the following commands in a terminal window
  31. <div class="codeBlock"># download nodejs<br />
  32. wget -O nodejs.tar.xz https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-arm64.tar.xz<br />
  33. # extract nodejs.tar.xz<br />
  34. tar -xJf nodejs.tar.xz<br />
  35. # change directory to extracted folder<br />
  36. cd node-v14.17.0-linux-arm64<br />
  37. # copy node binaries to /usr/local<br />
  38. sudo cp -R * /usr/local/<br />
  39. # test node is working<br />
  40. node -v<br />
  41. # test npm is working<br />
  42. npm -v</div>
  43. </li>
  44. </ol>
  45. <h2>Running a Test NodeJS Application</h2>
  46. <ol>
  47. <li>Run the following commands in a terminal window
  48. <div class="codeBlock"># install git<br />
  49. sudo apt install git -y<br />
  50. # make a working diretory<br />
  51. mkdir ~/njs-demo &amp;&amp; cd ~/njs-demo<br />
  52. # clone demo github repo<br />
  53. git clone https://github.com/benc-uk/nodejs-demoapp.git<br />
  54. # cd into src directory<br />
  55. cd nodejs-demoapp/src<br />
  56. # install dependencies<br />
  57. npm install<br />
  58. # run the demo app<br />
  59. node server.js</div>
  60. </li>
  61. <li>Open a web browser and navigate to http://DNSorIP:3000</li>
  62. </ol>
  63. </div>
  64. </div>
  65. </body>
  66. </html>