Running with npm_config_platform=win32 on linux fails
dimadeveatii opened this issue · comments
Dumitru commented
I encountered an issue making an electron build for windows on linux (using the recommended electronuserland/builder:wine
docker container).
Steps to reproduce
- Use a linux machine to install
electron-chromedriver
- Install with command:
npm_config_platform=win32 npm i electron-chromedriver
Actual result
Installation fails with error:
/app/node_modules/electron-chromedriver/download-chromedriver.js:24
if (error != null) throw error
^
[Error: ENOENT: no such file or directory, chmod '/app/node_modules/electron-chromedriver/bin/chromedriver'] {
errno: -2,
code: 'ENOENT',
syscall: 'chmod',
path: '/app/node_modules/electron-chromedriver/bin/chromedriver'
}
Expected result
Installation finishes successfully with win32 driver downloaded.
I think the problem is in this line:
if (process.platform !== 'win32') {
await fs.chmod(path.join(targetFolder, 'chromedriver'), 0o755)
}
Shouldn't it be process.env.npm_config_platform
instead of process.platform
?
Or at least, in case of windows it should chmod
the chromedriver.exe
file.