can't install or run due to the “catch” throws a Syntax Error
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 8.0.0
- Platform / OS version: win7 and win10
- URLs (if applicable):
- Node.js version: 9.4.0
What steps will reproduce the problem? when i install or use node xxx.js to run a js file
Please include code that reproduces the issue.
1.npm i puppeteer
2.node xxx.js
What is the expected result? i think the catch`s Syntax is ‘catch(err) {}’ not ‘catch{}’
What happens instead?
npm i puppeteer
result:
(node:9820) UnhandledPromiseRejectionWarning: …\node_modules\puppeteer\lib\cjs\puppeteer\node\install.js:139
catch {
^
SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm.js:138:10)
at Object.runInThisContext (vm.js:199:10)
at Module._compile (module.js:624:28)
at Object.Module._extensions…js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
node xxx.js
result:
node xxx.js
…\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:712
catch {
^
SyntaxError: Unexpected token { at new Script (vm.js:51:7) at createScript (vm.js:138:10) at Object.runInThisContext (vm.js:199:10) at Module._compile (module.js:624:28) at Object.Module._extensions…js (module.js:671:10) at Module.load (module.js:573:32) at tryModuleLoad (module.js:513:12) at Function.Module._load (module.js:505:3) at Module.require (module.js:604:17) at require (internal/module.js:11:18)
this is source code:
page.js: L709~L716
try {
payload = JSON.parse(event.payload);
}
catch {
// The binding was either called by something in the page or it was
// called before our wrapper was initialized.
return;
}
install.js : L135~L141
try {
const versions = JSON.parse(data);
return resolve(versions.FIREFOX_NIGHTLY);
}
catch {
return reject(new Error('Firefox version not found'));
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5

Top Related StackOverflow Question
Here’s a solution.
Same problem here. Solved by upgrading node to 14