0507.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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="How To,Tutorial,i12bretro,NodeJS,Armbian,SBC,Single Board Computer,Raspberry Pi Alternative,Amlogic,Development">
  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. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  12. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  13. <script type="text/javascript" src="includes/js/steps.js"></script>
  14. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  15. </head>
  16. <body>
  17. <div id="gridContainer">
  18. <div class="topMargin"></div>
  19. <div id="listName" class="topMargin">
  20. <h1>Install NodeJS on Armbian</h1>
  21. </div>
  22. <div></div>
  23. <div id="content">
  24. <h2>What is NodeJS</h2>
  25. <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>
  26. <h2>Installing NodeJS</h2>
  27. <ol>
  28. <li>Log into the Armbian device</li>
  29. <li>Run the following commands in a terminal window
  30. <div class="codeBlock"># download nodejs<br />
  31. wget -O nodejs.tar.xz https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-arm64.tar.xz<br />
  32. # extract nodejs.tar.xz<br />
  33. tar -xJf nodejs.tar.xz<br />
  34. # change directory to extracted folder<br />
  35. cd node-v14.17.0-linux-arm64<br />
  36. # copy node binaries to /usr/local<br />
  37. sudo cp -R * /usr/local/<br />
  38. # test node is working<br />
  39. node -v<br />
  40. # test npm is working<br />
  41. npm -v</div>
  42. </li>
  43. </ol>
  44. <h2>Running a Test NodeJS Application</h2>
  45. <ol>
  46. <li>Run the following commands in a terminal window
  47. <div class="codeBlock"># install git<br />
  48. sudo apt install git -y<br />
  49. # make a working diretory<br />
  50. mkdir ~/njs-demo &amp;&amp; cd ~/njs-demo<br />
  51. # clone demo github repo<br />
  52. git clone https://github.com/benc-uk/nodejs-demoapp.git<br />
  53. # cd into src directory<br />
  54. cd nodejs-demoapp/src<br />
  55. # install dependencies<br />
  56. npm install<br />
  57. # run the demo app<br />
  58. node server.js</div>
  59. </li>
  60. <li>Open a web browser and navigate to http://DNSorIP:3000</li>
  61. </ol>
  62. </div>
  63. </div>
  64. </body>
  65. </html>