I also tried switching Chip Select (CS) pin from D8 to D2 and issued the command: vol = file.mount("/SD0″, 2); but the same problem is present. vol is still nil and it doesn't mount.
On NodeMCU boards, the labels printed on the board are misleading. For example, D2 is not GPIO2. D2 is actually GPIO4. Google for "nodemcu pin out" for the full details.
-- Before mounting the volume(s) on the SD card, you need to -- initialize the SPI interface from Luaspi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, 8, 8)-- NOTE: the card initialization process during `file.mount()` will set spi divider temporarily to 200 (400 kHz)-- it's reverted back to the current user setting before `file.mount()` finishesvol = file.mount("/SD0:", 8) -- 2nd parameter is optional for non-standard SS/CS pinif not vol then print("retry mounting") vol = file.mount("/SD0:", 8) if not vol then error("mount failed") end else print("\nSD Card mounted\n")end