Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Node.js on esp8266 (Nodemcu dev board)?

I am trying to connect Apple homekit to nodemcu board, I found a tutorial which works on my computer, but I am wonder if there is any way to load and run Node.JS on a NodeMCU board (ESP8266)?

like image 219
jezuz Avatar asked Aug 30 '15 20:08

jezuz


People also ask

How do I run a node js code?

The usual way to run a Node. js program is to run the globally available node command (once you install Node. js) and pass the name of the file you want to execute. While running the command, make sure you are in the same directory which contains the app.

Does ESP8266 support JavaScript?

We want our ESP8266 board to connect to our internal network automatically. Fortunately, with a few lines of JavaScript in the console we can configure it and store these settings in flash memory.


2 Answers

You can run Espruino on it. I have the HiLetgo NodeMCU ESP-12E Module and was easily able to load the firmware.

  1. Download and install flasher https://github.com/thingsSDK/flasher.js
  2. Press and hold the flash button press the reset button once. It will flash once.
  3. Open up flasher app and flash the firmware for Espruino.
  4. Unplug the esp8266 and plug it back in
  5. download the web ide for Espruino https://chrome.google.com/webstore/detail/espruino-web-ide/bleoifhkdalbjfbobjackfdifdneehpo?hl=en
  6. Change the baud rate Settings --> Communications --> Baud Rate 115200
  7. Connect and enjoy!

Some samples to try out

https://github.com/mertenats/NodeMCU-and-JavaScript

like image 141
Jesse Avatar answered Sep 21 '22 10:09

Jesse


I think you're confusing nodemcu, which is a firmware for the ESP8266 boards that interprets the language lua, with the javascript runtime node.js, which runs on computers.

So, the answer is you cannot run node.js on an ESP8266.

like image 28
user1816847 Avatar answered Sep 21 '22 10:09

user1816847