Skip to content

Commit 6c4011c

Browse files
anastasios-captureonegiggio
authored andcommitted
Creates the intermediate tmp folder before attempting to copy CHROMEDRIVER_FILEPATH to it.
Copying the binary no longer worked, unless the destination tmp folder already existed. Steps to reproduce: - rm -Rf /tmp/117.0.5938.92/chromedriver/ - CHROMEDRIVER_FILEPATH="/yourpathto/chromedriver" node node_modules/chromedriver/install.js Failed with: ``` ChromeDriver installation failed Error: ENOENT: no such file or directory, copyfile '/tmp/chromedriver' -> '/tmp/117.0.5938.92/chromedriver/chromedriver-linux64/chromedriver' at Object.copyFileSync (node:fs:2894:3) at extractDownload (/home/anastasios/Sources/cloud/web/node_modules/chromedriver/install.js:364:8) at install (/home/anastasios/Sources/cloud/web/node_modules/chromedriver/install.js:70:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { errno: -2, syscall: 'copyfile', code: 'ENOENT', path: '/tmp/chromedriver', dest: '/tmp/117.0.5938.92/chromedriver/chromedriver-linux64/chromedriver' } ``` After this change it succeeds.
1 parent afe9bf9 commit 6c4011c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

install.js

+1
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ async function requestBinary(requestOptions, filePath) {
359359
*/
360360
async function extractDownload(dirToExtractTo, chromedriverBinaryFilePath, downloadedFile) {
361361
if (path.extname(downloadedFile) !== '.zip') {
362+
fs.mkdirSync(path.dirname(chromedriverBinaryFilePath), {recursive: true});
362363
fs.copyFileSync(downloadedFile, chromedriverBinaryFilePath);
363364
console.log('Skipping zip extraction - binary file found.');
364365
return;

0 commit comments

Comments
 (0)