Ich arbeite an einem kleinen Projekt Nodejs (Nodejs V4.3), die Knoten-Serialport https://github.com/voodootikigod/node-serialport verwendet. Ich wickelte es in ein Docker-Bild. Zuerst habe ich Debian erfolgreich als Basis-Image verwendet, aber es hatte eine Gesamtgröße von ca. 600MB. Dann wechselte ich auf alpine linux https://hub.docker.com/_/alpine/ und erreichte 100MB Bildgröße. Das Projekt nodejs hat jedoch nicht mehr mit alpine als Basis-Image gearbeitet. Hier sind einige Protokolle:Knoten-Serialport auf Alpine Linux Fehler
Installieren Knoten-Serialport Protokoll:
> [email protected] install /app/node_modules/serialport
> node-pre-gyp install --fallback-to-build
[serialport] Success: "/app/node_modules/serialport/build/Release/node-v46-linux-x64/serialport.node" is installed via remote
[email protected] node_modules/serialport
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
└── [email protected] ([email protected], [email protected])
Wenn ich versuche, einen seriellen Port zu öffnen, bekomme ich einen Fehler:
npm ERR! Linux 3.19.0-30-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v4.3.0
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./bin/www'.
npm ERR! This is most likely a problem with the app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get their info via:
npm ERR! npm owner ls app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /app/app/npm-debug.log
module.js:435
return process.dlopen(module, path._makeLong(filename));
^
Error: Error relocating /app/app/node_modules/serialport/build/Release/node-v46-linux-x64/serialport.node: __strcpy_chk: symbol not found
at Error (native)
at Object.Module._extensions..node (module.js:435:18)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/app/app/node_modules/serialport/serialport.js:14:25)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
Wie gesagt, mit Debian als Basis Bild es hat funktioniert. Ich denke, es könnte mit der Tatsache zusammenhängen, dass alpine Linux etwas fehlt, von dem Knoten-Serialport abhängt. Ich habe ein Problem auf https://github.com/voodootikigod/node-serialport/issues/682 erstellt, aber ich bin mir nicht sicher, ob dies ein Problem mit Node-Serialport oder Alpine Linux ist. Ich habe gelesen, dass Knoten-Pre-gyp auf alpine/busybox fehlerhaft ist.
haben Sie versucht, ubuntu ein Paket wie 'build-essentials' bei der Installation? – ArsalanDotMe
@ArsalanDotMe ja, make und g ++ –