seppevs / migrate-mongo

A database migration tool for MongoDB in Node
MIT License
931 stars 166 forks source link

Unexpected token { because ES10 syntax in fs-extra #202

Closed ayame30 closed 4 years ago

ayame30 commented 4 years ago

I am currently using node 8.11.3, and I am facing unexpected token { issue when I use migrate-mongo init

How to reproduce node 8.11.3 and migrate-mongo init

node@b531b9ebb1eb:/opt/reaction/src$ npm run migrate

> reaction@2.7.0 migrate /opt/reaction/src
> migrate-mongo init

/opt/reaction/src/node_modules/migrate-mongo/node_modules/fs-extra/lib/mkdirs/make-dir.js:86
      } catch {
              ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/opt/reaction/src/node_modules/migrate-mongo/node_modules/fs-extra/lib/mkdirs/index.js:3:44)

fs-extra seems using optional catch binding which only supported in ES10.

AnthonyTsang commented 4 years ago

same issue

seppevs commented 4 years ago

Fixed in v7.2.1 I've downgraded the fs-extra dependency.

Nevertheless, I strongly advice you to upgrade to Node 10 or higher asap, since Node 8 is not maintained anymore.

ayame30 commented 4 years ago

Thank you for the fix