puppeteer-lambda-starter-kit icon indicating copy to clipboard operation
puppeteer-lambda-starter-kit copied to clipboard

Cannot cd into '/tmp'

Open md97212 opened this issue 6 years ago • 3 comments

In trying to setup local chome in this block,

const setupLocalChrome = () => {
    return new Promise((resolve, reject) => {
        fs.createReadStream(config.localChromePath)
            .on('error', (err) => reject(err))
            .pipe(tar.x({
                C: config.setupChromePath,
            }))
            .on('error', (err) => reject(err))
            .on('end', () => resolve());
    });
};

I get this error, has anyone else bumped into this and found a good solution? I suppose I can chmod the /tmp directory but that seems like a hack.

Cwd Error ----------------------------------------------
 
  ENOTDIR: Cannot cd into '/tmp'
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Stack Trace --------------------------------------------
 
CwdError: ENOTDIR: Cannot cd into '/tmp'
    at CwdError (/Users/mark/dev/repos/spr-renderer/node_modules/tar/lib/mkdir.js:26:5)
    at fs.lstat (/Users/mark/dev/repos/spr-renderer/node_modules/tar/lib/mkdir.js:74:14)
    at FSReqWrap.oncomplete (fs.js:123:15)

md97212 avatar Oct 29 '17 14:10 md97212

I'm running into the same problem trying to run this locally. Did you find a solution?

ThePaulMcBride avatar Mar 12 '18 14:03 ThePaulMcBride

I switched the code from:

.pipe(tar.x({
  C: path.join(path.sep, 'tmp')
}))

to:

.pipe(tar.x({
  C: path.join(process.cwd(), path.sep, 'tmp')
}))

and it worked (after creating tmp directory in my application folder).

MikeGertrudes avatar Apr 02 '18 00:04 MikeGertrudes

@MikeGertrudes I have got this worked in Lambda, for lambda usage, seems you shouldn't add that "process.cwd()".

conanmy avatar Jun 29 '18 00:06 conanmy