Skip to content

Commit 46470b0

Browse files
committed
fix: "Fatal: [Errno 2] No such file or directory; did you install phantomjs?"
1 parent cde3456 commit 46470b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/runner.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ module.exports = function (fileName, args, callback) {
3030
}
3131
}
3232

33-
console.log('PATH', process.env['PATH']);
3433
// Set the path as described here: https://aws.amazon.com/blogs/compute/running-executables-in-aws-lambda/
3534
if (process.env['LAMBDA_TASK_ROOT']) {
36-
process.env['PATH'] = process.env['PATH'] + ':' + process.env['LAMBDA_TASK_ROOT'];
35+
// adding ':/var/task/bin' in path fixes the issue: "Fatal: [Errno 2] No such file or directory; did you install phantomjs?"
36+
// reference: https://github.com/narainsagar/node-casperjs-aws-lambda/issues/3
37+
process.env['PATH'] = process.env['PATH'] + ':' + process.env['LAMBDA_TASK_ROOT'] + ':/var/task/bin';
3738
}
3839
console.log('PATH', process.env['PATH']);
3940
console.log('Calling casperJS: ', casperPath, options, phantomOptions);

0 commit comments

Comments
 (0)