Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
running node.js using systemd but systemd couldn't find html

Using raspberry pi4, express for server, get data through socket.io, and send the data to client side(html) and log on rest API.

The problem is that systemd couldn't find html file. When I run $ sudo systemctl start FileToServer.service HTML shows me this error message.

Error: ENOENT: no such file or directory, stat '/index.html' 
  1. $ node server.js is working. and i can see what i want and there isn't any error messages.
  2. sudo systemctl start FileToServer.service can also run the server.js
  3. I checked sudo systemctl status FileToServer.service, and confirmed active is active(running).
  4. I also run using $ sudo su and it didn't work

What can i do ?

[Unit]
Description=usb lte

[Service]
Type=simple
ExecStart=/usr/bin/node /home/pi/Desktop/rpi4_clientside/server.js
Restart=on-failure
#User=pi
#User=root
#Group=root

[Install]
WantedBy=multi-user.target

This is the code snippet i'm struggling. server.js

    import express from "express";
    const app = express();
    import { SerialPort } from "serialport";
    import { ReadlineParser } from "@serialport/parser-readline";

    import { createServer } from "http"; 
    import { Server } from "socket.io";
    const httpServer = createServer(app);
    const io = new Server(httpServer, {});

    import axios from "axios";
    import path from 'path';
    const __dirname = path.resolve();
    const PORTnum = 3000;
    const publicIp = "222.33.222.33"
    const localIp = "172.3.1.2"
    const serverSidePort = "5500"
    let api_url = `http://${publicIp}:${serverSidePort}/gps`;

    httpServer.listen(PORTnum, () => {
      console.log(`it's alive on http://localhost:${PORTnum}`);
    })

    app.use(express.json())

    app.get("/", (req, res) => {
      // console.log(res);
      res.sendFile(__dirname + "/index.html");
    });

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda