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

Error on require when using Node.js pre-7.6 #3

Closed
rivajunior opened this issue Jun 13, 2017 · 2 comments
Closed

Error on require when using Node.js pre-7.6 #3

rivajunior opened this issue Jun 13, 2017 · 2 comments
Assignees

Comments

@rivajunior
Copy link

I am for the first time trying to minify my php code for increase my score in pagespeed by Google.

But I find that error when I require the plugin gulp-php-minify. You can see in code below.

const {phpMinify} = require('@cedx/gulp-php-minify');

I did the same as the example on the plugin page.

/var/www/project-name/node_modules/@cedx/gulp-php-minify/lib/fast_transformer.js:35
  async close() {
        ^^^^^
SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/var/www/project-name/node_modules/@cedx/gulp-php-minify/lib/index.js:7:25)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
@agbottan
Copy link

@rivajunior , I had this same problem. It's because of the 'async' keyword which is a new feature in ES7.
I fixed the problem updating my node.js to version 8.
They say it works on version 7, but I didn't tested.

@cedx cedx self-assigned this Jun 22, 2017
@cedx cedx changed the title Error on require Error on require when using Node.js pre-7.6 Jun 22, 2017
@cedx cedx added the wontfix label Jun 22, 2017
@cedx
Copy link
Owner

cedx commented Jun 22, 2017

@agbottan found the issue : I'm using async/await functions in this package. These ES2017 features require a Node.js 7.6+ runtime.

@rivajunior, you must either upgrade your Node.js runtime, or downgrade the gulp-php-minify version to 1.1.0 (the last one working with a pre-7.6 runtime). But beware : there was some issues with old versions. You should really consider to upgrade your Node.js runtime (v8 will be the next LTS in a few months).

@cedx cedx closed this as completed Jun 22, 2017
@cedx cedx mentioned this issue Nov 10, 2017
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

3 participants