capture-screenshot
capture-screenshot copied to clipboard
The filename, directory name, or volume label syntax is incorrect
Followed the example.
- Installed:
npm install capture-screenshot --save
- Ran the example:
const capture = require('capture-screenshot');
const fs = require('fs');
capture({url: 'https://twitter.com/'})
.then(imgs => {
fs.writeFileSync('chrome.png', imgs.chrome);
fs.writeFileSync('electron.png', imgs.electron);
fs.writeFileSync('phantomjs.png', imgs.phantomjs);
});
But got error:
(node:9444) UnhandledPromiseRejectionWarning: Error: Command failed: 'C:\Users\PragmaticEd\workspace\_private\TestApp\node_modules\electron\dist\electron.exe' 'C:\Users\PragmaticEd\workspace\_private\TestApp\node_modules\capture-electron/script/render.js' 'https://twitter.com/' 1024 768 0 png
The filename, directory name, or volume label syntax is incorrect.
at ChildProcess.exithandler (child_process.js:289:12)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Socket.stream.socket.on (internal/child_process.js:381:11)
at Socket.emit (events.js:182:13)
at Pipe._handle.close (net.js:606:12)
(node:9444) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9444) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I noticed that this package installed capture-electron
but this error says it tries to access node_modules\electron
. Could that be the reason?
Just for giggles, i installed electron
and i got slitly different error:
(node:33936) UnhandledPromiseRejectionWarning: Error: Command failed: 'C:\Users\PragmaticEd\workspace\_private\TestApp\node_modules\capture-electron\node_modules\electron\dist\electron.exe' 'C:\Users\PragmaticEd\workspace\_private\TestApp\node_modules\capture-electron/script/render.js' 'https://twitter.com/' 1024 768 0 png
The filename, directory name, or volume label syntax is incorrect.
at ChildProcess.exithandler (child_process.js:289:12)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Socket.stream.socket.on (internal/child_process.js:381:11)
at Socket.emit (events.js:182:13)
at Pipe._handle.close (net.js:606:12)
(node:33936) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:33936) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Note how, before i installed electron
, it was checking for node_modules\electron\dist\electron.exe
, but after i installed electron, it started checking: node_modules\capture-electron\node_modules\electron\dist\electron.exe
Platform: WIndows 10
The culprit is probably https://github.com/juliangruber/capture-electron/blob/master/index.js. Would you mind debugging this a little, playing around with different ways of executing the electron command? I don't have a windows machine at hand.