sbs20 / scanservjs

SANE scanner nodejs web ui
https://sbs20.github.io/scanservjs/
GNU General Public License v2.0
766 stars 145 forks source link

Error: ENOENT: no such file or directory, open 'data/preview/default.jpg' - Think there is a folder or file mapping issue #720

Open nunnsby opened 8 months ago

nunnsby commented 8 months ago

Docker Conatiner image

Error Message:

} [2024-03-22T01:11:31.267Z] INFO (Http): { method: 'GET', path: '/api/v1/preview' } [2024-03-22T01:11:31.267Z] ERROR (Http): Error: ENOENT: no such file or directory, open 'data/preview/default.jpg' at Object.openSync (node:fs:600:3) at Object.readFileSync (node:fs:468:35) at FileInfo.toBuffer (/usr/lib/scanservjs/server/classes/file-info.js:182:21) at Api.readPreview (/usr/lib/scanservjs/server/api.js:111:78) at Object.callback (/usr/lib/scanservjs/server/express-configurer.js:131:32) at /usr/lib/scanservjs/server/express-configurer.js:210:22 at Layer.handle [as handle_request] (/usr/lib/scanservjs/node_modules/express/lib/router/layer.js:95:5) at next (/usr/lib/scanservjs/node_modules/express/lib/router/route.js:144:13) at Route.dispatch (/usr/lib/scanservjs/node_modules/express/lib/router/route.js:114:3) at Layer.handle [as handle_request] (/usr/lib/scanservjs/node_modules/express/lib/router/layer.js:95:5) { errno: -2, syscall: 'open', code: 'ENOENT', path: 'data/preview/default.jpg' }

Assumption: Scan pipeline does not complete when using the web server. The scanner scans the image to a temp tiff file ('~tmp-scan-0-0001.tif') in the temp folder, but then gives the ENOENT error. It recognises my scanner, and the features and capabilities, but does not complete the process. The scanned .tif file is correct. I think there is a file or folder mapping issue somewhere.

Printer is a Samsung M2040, mapped via saned over the network, to a raspberry pi, where it is connected via USB. I am using a xerox driver on the pi, as that is the one that works.

I can connect to saned over the network via a Windows machine and all works fine.

DOCKER-COMPOSE CONFIG:

version: '3.3' services: scanserv: image: sbs20/scanservjs:latest container_name: scanservjs restart: unless-stopped ports:

  • '8070:8080' privileged: true environment:
  • SANED_NET_HOSTS=192.168.123.43 volumes:
  • /mnt/_data/_docker/scanserv:/var/lib/scanservjs

ADDITONAL LOGS ... redacted in areas for simplicity

[2024-03-22T09:17:13.947Z] INFO (Http): { method: 'GET', path: '/api/v1/context' } [2024-03-22T09:17:13.948Z] INFO (Api): Context { devices: [ Device { id: 'net:192.168.123.43:xerox_mfp:libusb:001:004', name: 'net:192.168.123.43:xerox_mfp:libusb:001:004', features: { ... REMOVED FOR SIMPLICITY AS YOU CAN SEE CAPABILITIES EXIST } }, string: '\n' + "All options specific to device `net:192.168.123.43:xerox_mfp:libusb:001:004':\n" + ' Standard:\n' + ' --resolution 75|100|150|200|300|600dpi [150]\n' + ' Sets the resolution of the scanned image.\n' + ' --mode Lineart|Halftone|Gray|Color [Color]\n' + ' Selects the scan mode (e.g., lineart, monochrome, or color).\n' + ' --highlight 30..70% (in steps of 10) [inactive]\n' + ' Select minimum-brightness to get a white point\n' + ' --source Flatbed|ADF|Auto [Flatbed]\n' + ' Selects the scan source (such as a document-feeder).\n' + ' Geometry:\n' + ' -l 0..216.069mm (in steps of 1) [0]\n' + ' Top-left x position of scan area.\n' + ' -t 0..297.18mm (in steps of 1) [0]\n' + ' Top-left y position of scan area.\n' + ' -x 0..216.069mm (in steps of 1) [216.069]\n' + ' Width of scan-area.\n' + ' -y 0..297.18mm (in steps of 1) [297.18]\n' + ' Height of scan-area.\n' + '\n', settings: { ... REMOVED FOR SIMPLICITY AS YOU CAN SEE CAPABILITIES EXIST }, pipeline: { options: [ 'JPG | @:pipeline.high-quality', 'JPG | @:pipeline.medium-quality', 'JPG | @:pipeline.low-quality', 'PNG', 'TIF | @:pipeline.uncompressed', 'TIF | @:pipeline.lzw-compressed', 'PDF (TIF | @:pipeline.uncompressed)', 'PDF (TIF | @:pipeline.lzw-compressed)', 'PDF (JPG | @:pipeline.high-quality)', 'PDF (JPG | @:pipeline.medium-quality)', 'PDF (JPG | @:pipeline.low-quality)', '@:pipeline.ocr | PDF (JPG | @:pipeline.high-quality)', '@:pipeline.ocr | @:pipeline.text-file' ], default: 'JPG | @:pipeline.high-quality' } } } ], version: '3.0.3', diagnostics: [ { success: true, message: 'Found /usr/bin/scanimage' }, { success: true, message: 'Found /usr/bin/convert' } ], paperSizes: [ { ... REMOVED FOR SIMPLICITY AS YOU CAN SEE CAPABILITIES EXIST } ], actions: [] }

[2024-03-22T09:17:14.075Z] INFO (Http): { method: 'GET', path: '/api/v1/preview' } [2024-03-22T09:17:14.075Z] ERROR (Http): Error: ENOENT: no such file or directory, open 'data/preview/default.jpg' at Object.openSync (node:fs:600:3) at Object.readFileSync (node:fs:468:35) at FileInfo.toBuffer (/usr/lib/scanservjs/server/classes/file-info.js:182:21) at Api.readPreview (/usr/lib/scanservjs/server/api.js:111:78) at Object.callback (/usr/lib/scanservjs/server/express-configurer.js:131:32) at /usr/lib/scanservjs/server/express-configurer.js:210:22 at Layer.handle [as handle_request] (/usr/lib/scanservjs/node_modules/express/lib/router/layer.js:95:5) at next (/usr/lib/scanservjs/node_modules/express/lib/router/route.js:144:13) at Route.dispatch (/usr/lib/scanservjs/node_modules/express/lib/router/route.js:114:3) at Layer.handle [as handle_request] (/usr/lib/scanservjs/node_modules/express/lib/router/layer.js:95:5) { errno: -2, syscall: 'open', code: 'ENOENT', path: 'data/preview/default.jpg' } [2024-03-22T09:17:22.954Z] INFO (Http): { method: 'DELETE', path: '/api/v1/context' } [2024-03-22T09:17:22.981Z] INFO (Http): { method: 'GET', path: '/api/v1/context' } [2024-03-22T09:17:22.982Z] INFO (Application): devices.json does not exist. Reloading [2024-03-22T09:17:22.982Z] INFO (Process): { execute: '/usr/bin/scanimage -L' } [2024-03-22T09:17:29.485Z] INFO (Process): { execute: "/usr/bin/scanimage -d 'net:192.168.123.43:xerox_mfp:libusb:001:004' -A" } [2024-03-22T09:17:39.839Z] INFO (Http): { method: 'POST', path: '/api/v1/preview', body: { version: '3.0.3', params: { deviceId: 'net:192.168.123.43:xerox_mfp:libusb:001:004', resolution: 150, width: 210, height: 297, left: 0, top: 0, mode: 'Color', source: 'Flatbed' }, filters: [], pipeline: 'JPG | @:pipeline.high-quality', batch: 'none', index: 1 } } [2024-03-22T09:17:39.840Z] INFO (Process): { spawn: "/usr/bin/scanimage -d 'net:192.168.123.43:xerox_mfp:libusb:001:004' --source Flatbed --mode Color --resolution 100 -l 0 -t 0 -x 216 -y 297.1 --format tiff -o data/preview/preview.tif" }

[2024-03-22T09:17:40.853Z] INFO (Http): { method: 'GET', path: '/api/v1/preview' } [2024-03-22T09:17:40.853Z] ERROR (Http): Error: ENOENT: no such file or directory, open 'data/preview/default.jpg' at Object.openSync (node:fs:600:3) at Object.readFileSync (node:fs:468:35) at FileInfo.toBuffer (/usr/lib/scanservjs/server/classes/file-info.js:182:21) at Api.readPreview (/usr/lib/scanservjs/server/api.js:111:78) at Object.callback (/usr/lib/scanservjs/server/express-configurer.js:131:32) at /usr/lib/scanservjs/server/express-configurer.js:210:22 at Layer.handle [as handle_request] (/usr/lib/scanservjs/node_modules/express/lib/router/layer.js:95:5) at next (/usr/lib/scanservjs/node_modules/express/lib/router/route.js:144:13) at Route.dispatch (/usr/lib/scanservjs/node_modules/express/lib/router/route.js:114:3) at Layer.handle [as handle_request] (/usr/lib/scanservjs/node_modules/express/lib/router/layer.js:95:5) { errno: -2, syscall: 'open', code: 'ENOENT', path: 'data/preview/default.jpg' } [2024-03-22T09:17:41.014Z] ERROR (Http): Error: /usr/bin/scanimage -d 'net:192.168.123.43:xerox_mfp:libusb:001:004' --source Flatbed --mode Color --resolution 100 -l 0 -t 0 -x 216 -y 297.1 --format tiff -o data/preview/preview.tif exited with code: 1, stderr: scanimage: could not open output file 'data/preview/preview.tif', exiting at ChildProcess. (/usr/lib/scanservjs/server/classes/process.js:85:18) at ChildProcess.emit (node:events:513:28) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) [2024-03-22T09:17:42.048Z] INFO (Http): { method: 'GET', path: '/api/v1/preview' } [2024-03-22T09:17:42.049Z] ERROR (Http): Error: ENOENT: no such file or directory, open 'data/preview/default.jpg' at Object.openSync (node:fs:600:3) at Object.readFileSync (node:fs:468:35) at FileInfo.toBuffer (/usr/lib/scanservjs/server/classes/file-info.js:182:21) at Api.readPreview (/usr/lib/scanservjs/server/api.js:111:78) at Object.callback (/usr/lib/scanservjs/server/express-configurer.js:131:32) at /usr/lib/scanservjs/server/express-configurer.js:210:22 at Layer.handle [as handle_request] (/usr/lib/scanservjs/node_modules/express/lib/router/layer.js:95:5) at next (/usr/lib/scanservjs/node_modules/express/lib/router/route.js:144:13) at Route.dispatch (/usr/lib/scanservjs/node_modules/express/lib/router/route.js:114:3) at Layer.handle [as handle_request] (/usr/lib/scanservjs/node_modules/express/lib/router/layer.js:95:5) { errno: -2, syscall: 'open', code: 'ENOENT', path: 'data/preview/default.jpg' } [2024-03-22T09:17:48.391Z] INFO (Http): { method: 'POST', path: '/api/v1/scan', body: { version: '3.0.3', params: { deviceId: 'net:192.168.123.43:xerox_mfp:libusb:001:004', resolution: 150, width: 210, height: 297, left: 0, top: 0, mode: 'Color', source: 'Flatbed' }, filters: [], pipeline: 'JPG | @:pipeline.high-quality', batch: 'none', index: 1 } } [2024-03-22T09:17:48.393Z] INFO (ScanController): Scanning [2024-03-22T09:17:48.393Z] INFO (Process): { spawn: "/usr/bin/scanimage -d 'net:192.168.123.43:xerox_mfp:libusb:001:004' --source Flatbed --mode Color --resolution 150 -l 0 -t 0 -x 210 -y 297 --format tiff -o data/temp/~tmp-scan-0-0001.tif" } [2024-03-22T09:17:58.139Z] INFO (Process): { spawn: "/usr/bin/convert data/temp/~tmp-scan-0-0001.tif -scale 844 -background '#808080' -extent 868x1194-0-0 data/preview/preview.tif" } [2024-03-22T09:17:58.205Z] ERROR (Http): Error: /usr/bin/convert data/temp/~tmp-scan-0-0001.tif -scale 844 -background '#808080' -extent 868x1194-0-0 data/preview/preview.tif exited with code: 1, stderr: convert: unable to open image `data/preview/preview.tif': No such file or directory @ error/blob.c/OpenBlob/2924. at ChildProcess. (/usr/lib/scanservjs/server/classes/process.js:85:18) at ChildProcess.emit (node:events:513:28) at maybeClose (node:internal/child_process:1091:16) at Socket. (node:internal/child_process:449:11) at Socket.emit (node:events:513:28) at Pipe. (node:net:321:12)

LCernei commented 8 months ago

I have a similar issue/error.
I solved it by manually adding a default.jpg file
looking at your DOCKER-COMPOSE CONFIG, I think you should add a folder: /mnt/_data/_docker/scanserv/preview/
and in that folder put any image named default.jpg: /mnt/_data/_docker/scanserv/preview/default.jpg
(as for the actual bug - maybe #700 solves this?)