Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 7 async await syntax error #381

Closed
TonyWuLihu opened this issue Jan 23, 2018 · 7 comments
Closed

Node 7 async await syntax error #381

TonyWuLihu opened this issue Jan 23, 2018 · 7 comments

Comments

@TonyWuLihu
Copy link

I'm trying to use the j2v8 on my Mac which installed node v7.10 , I use below js code in a file:
/**

  • Created by tonymac on 2018/1/18.
    */
    'use strict';
    const puppeteer = require('puppeteer');

(async () => {
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
const page = await browser.newPage();
await page.emulateMedia('print');
await page.goto('https://dev.capitalpreferences.com/dashboard/setup/signin', {waitUntil: 'networkidle2'});
await page.waitFor(10000);
await page.pdf({path: 'demo.pdf',printBackground: true});
await browser.close();
})();

Error throw
node.js:376
callback();
^
/Volumes/PDrive/Projects/capital_preferences_api/pdfreport.js:7: SyntaxError: Unexpected token (

Any ideas ?

@TonyWuLihu
Copy link
Author

But I can execute the script by node js in command line

@TonyWuLihu
Copy link
Author

Or should I ask whether J2V8 support the new feature of async/await ???

@prakapenka
Copy link

prakapenka commented Jan 30, 2018

nodeJS = NodeJS.createNodeJS();
String version = nodeJS.getNodeVersion();

... and check returned version is supports async/await...
(means returned version can be different from version you have on your host machine)

@TonyWuLihu
Copy link
Author

@prakapenka Thanks! Indeed, they are different version. The V8 version with J2V8 is 4.6 while I check the V8 version on my terminal of macos, It's 5.5

@TonyWuLihu
Copy link
Author

How to solve this ? compile the J2V8 by myself ? Where could I find the guide for custom cross compile the versions ?

@pboymt
Copy link

pboymt commented Jun 16, 2018

我就用中文说了,J2V8的v8引擎版本是5.4,到5.5才支持async/await语法,然而现在v8的官方版本已经到6.9了,支持到ES2018了,我现在只能说自己动手丰衣足食……

@irbull
Copy link
Member

irbull commented Jan 11, 2019

Closing this as a duplicate of #433. That is the bug we are using to track updating to a newer V8.

@irbull irbull closed this as completed Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants