Parcel: Using babel-plugin-transform-class-properties error: Unsupported babel version: 5.8.3

Created on 6 Sep 2018  ยท  5Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report

I'm working with an almost fresh parcel setup. I've added a .babelrc because I need babel-plugin-transform-class-properties:

{
  "plugins": ["transform-class-properties"]
}

package.json

...
  "devDependencies": {
    "babel-eslint": "^9.0.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "csscomb": "^4.2.0",
    "eslint": "^5.5.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-import-order-autofix": "^0.8.3",
    "husky": "^0.14.3",
    "lint-staged": "^7.2.2",
    "node-sass": "^4.9.3",
    "prettier": "^1.14.2"
  }
...

๐Ÿค” Expected Behavior

Parcel should work with babel-plugin-transform-class-properties.

๐Ÿ˜ฏ Current Behavior

When running with a basic example I get

 $ parcel index.html
Server running at http://localhost:1234 
 ๐Ÿšจ  /Users/u/git/x/index.js: Unsupported babel version: 5.8.38
    at babelTransform (/Users/u/.config/yarn/global/node_modules/parcel-bundler/src/transforms/babel.
js:46:11)

After that I also tried "babel-preset-react" and "stage-0" - nothing worked - I'm getting the same error all the time. I cleared the cache with yarn and reinstalled the deps several times. Also using npm did not solve the problem.

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel |1.9.7
| Node | v10.9.0
| npm/Yarn |1.9.4
| Operating System | macOS 10.13.6

Any ideas? Thanks for your help!

Waiting Question

Most helpful comment

That's strange, it's definitely getting babel-core from somewhere, as parcel does not use an old version internally.

Installing babel-core 6.x as a devDep into the project would probably solve the issue.

All 5 comments

Perhaps you have a global babel installed with version 5.8?

No global babel:

yarn global list

 info "[email protected]" has binaries:#######################################################---] 986/1018
    - gtop
 info "[email protected]" has binaries:
    - gzip-size
 info "[email protected]" has binaries:
    - json-server
 info "[email protected]" has binaries:
    - json2yaml
    - jsontoyaml
    - jsontoyml
    - json2yml
 info "[email protected]" has binaries:
    - parcel
 info "[email protected]" has binaries:
    - prettier
 info "[email protected]" has binaries:
    - tern
 info "[email protected]" has binaries:
    - vmd
 info "[email protected]" has binaries:
    - yaml2json
    - yamltojson
    - ymltojson
    - yml2json
 โœจ  Done in 0.88s

That's strange, it's definitely getting babel-core from somewhere, as parcel does not use an old version internally.

Installing babel-core 6.x as a devDep into the project would probably solve the issue.

I had the same issue:

npm i babel-core@6 --save-dev fixed it

Sorry for the late response (vacation!) - installing babel-core 6.x fixed it, thanks!

Was this page helpful?
0 / 5 - 0 ratings