You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After installing express@4.17.3 and rpi-led-matrix@1.11.1 I try to run an express server with the following code:
import { LedMatrix } from 'rpi-led-matrix';
import express, { Request, Response } from "express"
const matrix = new LedMatrix(
LedMatrix.defaultMatrixOptions(),
LedMatrix.defaultRuntimeOptions()
);
// Expressjs
const app = express()
app.use(express.json())
const PORT = process.env.port || 5555
let running = false
app.post('/move', (req: Request, res: Response) => {
console.log('/move', req.body)
res.send("OK")
})
// Get it started
matrix.sync();
app.listen(PORT, () => {
console.log(`⚡ Server running at https://localhost:${PORT}`)
})
When I send a POST /move with a basic json body I am met with the following error:
Error: Cannot find module '../encodings'
Require stack:
- /home/alex/battlesnake-board/node_modules/raw-body/node_modules/iconv-lite/lib/index.js
- /home/alex/battlesnake-board/node_modules/raw-body/index.js
- /home/alex/battlesnake-board/node_modules/body-parser/lib/read.js
- /home/alex/battlesnake-board/node_modules/body-parser/lib/types/json.js
- /home/alex/battlesnake-board/node_modules/body-parser/index.js
- /home/alex/battlesnake-board/node_modules/express/lib/express.js
- /home/alex/battlesnake-board/node_modules/express/index.js
- /home/alex/battlesnake-board/board.ts
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/alex/battlesnake-board/node_modules/@cspotcode/source-map-support/source-map-support.js:679:30)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.getCodec (/home/alex/battlesnake-board/node_modules/raw-body/node_modules/iconv-lite/lib/index.js:65:27)
at Object.getDecoder (/home/alex/battlesnake-board/node_modules/raw-body/node_modules/iconv-lite/lib/index.js:127:23)
at getDecoder (/home/alex/battlesnake-board/node_modules/raw-body/index.js:45:18)
at readStream (/home/alex/battlesnake-board/node_modules/raw-body/index.js:180:15)
at getRawBody (/home/alex/battlesnake-board/node_modules/raw-body/index.js:108:12)
There's one other Issue with this error but I can't seem to get it fixed. I think that the issue lies with the fact that I need to use sudo to have access to the gpio, but then I don't have access to node_modules when it's time to lazy load it. How can I reconcile this?
The text was updated successfully, but these errors were encountered:
Hi @BoldBigflank sorry for the delayed response. Have you had any success with this?
I'm going to go ahead and close the issue because I don't think a solution is within scope/capabilities of this library. (they're just bindings, after all) And, to be honest, I'm still baffled by how permissions and privileges work as they relate to the hardware access needed by the underlying hzeller library on a Raspberry Pi. My best suggestions would be to keep investigating that other issue you linked to, or dig further into the permissions stuff I just mentioned. Good luck!
After installing
express@4.17.3
andrpi-led-matrix@1.11.1
I try to run an express server with the following code:When I send a POST /move with a basic json body I am met with the following error:
There's one other Issue with this error but I can't seem to get it fixed. I think that the issue lies with the fact that I need to use sudo to have access to the gpio, but then I don't have access to node_modules when it's time to lazy load it. How can I reconcile this?
The text was updated successfully, but these errors were encountered: