JohannesHoffmann / herbiOS

A operating system for custom build vans
Other
20 stars 4 forks source link

Running Api (Server) #2

Open DerKleinePunk opened 3 years ago

DerKleinePunk commented 3 years ago

Can not Start the Backend Server

*@*:~/develop/herbiOS/api$ npm install
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated @types/socket.io@3.0.2: This is a stub types definition. socket.io provides its own type definitions, so you do not need this installed.
npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.

added 401 packages, and audited 402 packages in 3m

29 packages are looking for funding
  run `npm fund` for details

6 vulnerabilities (2 moderate, 4 high)
*@*:~/develop/herbiOS/api$ npm start

> herbi-api@1.0.0 start
> nodemon -e ts --watch 'src/**/*.ts' --exec 'ts-node' src/app.ts

sh: 1: nodemon: not found
DerKleinePunk commented 3 years ago

npm install -g nodemon npm install -g ts-node

server listening on http://0.0.0.0:5555
Read READYheater -do stop
[Error: ENOENT: no such file or directory, open '/tmp/shairport-sync-metadata'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/tmp/shairport-sync-metadata'
}
[nodemon] app crashed - waiting for file changes before starting...

After install That server is startet but crashed.

JohannesHoffmann commented 3 years ago

Thank's for your issue. I could reproduce the bug and fixed it with the latest changes. Hope it works for you?

DerKleinePunk commented 3 years ago

Next Crash

/home/punky/develop/herbiOS/api/src/lights/LightsService.ts:21
        for (const lightConfiguration of this.config.get().lights) {
                                                          ^
TypeError: this.config.get.lights is not iterable
    at new LightsService (/home/punky/develop/herbiOS/api/src/lights/LightsService.ts:21:59)
    at Function.getInstance (/home/punky/develop/herbiOS/api/src/lights/LightsService.ts:12:35)
    at LightsSocket._socket (/home/punky/develop/herbiOS/api/src/lights/LightsSocket.ts:31:45)
    at Namespace.<anonymous> (/home/punky/develop/herbiOS/api/src/api/websocket/NamespaceSocket.ts:59:18)
    at Namespace.emit (events.js:400:28)
    at Namespace.emit (domain.js:470:12)
    at Namespace.emitReserved (/home/punky/develop/herbiOS/api/node_modules/socket.io/dist/typed-events.js:56:22)
    at /home/punky/develop/herbiOS/api/node_modules/socket.io/dist/namespace.js:141:26
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

Question: Working with Sensorer on /dev/ttyACM0 with baudrate 500000 How to Config the Device and Baudrate. Not all Raspi hast ttyACM0 when Trun Off the Bluethooth ACM0 dit not Exits. The Baudrate ist not a Standard in C++ is difficoult to make this. On PC ACM0 Does not Exits for Testing Software.

JohannesHoffmann commented 3 years ago

This is caused because there is no update path at the moment. The server generates configuration files in the data directory. Delete all files and start the server again. It should generate new config files with the new structure for you.

You can modify the configurations for your needs. Add lights in the data/lights.json file for example.

The data/config.json file stores all configuration for the main system. There you can change the path for the serial connection of the sensorer as well the Baudrated.

I will add this to the readme.