Parcel: Unknown plugin "transform-es2015-arrow-functions" with basic project

Created on 17 Dec 2017  Β·  21Comments  Β·  Source: parcel-bundler/parcel

Bug Report πŸ›

I created a minimal project (following https://parceljs.org/getting_started.html. The only difference is that I include the package "ws" in package.json). Launching parcel via parcel index.html causes the error you can see below.

πŸŽ› Configuration (.babelrc, package.json, cli command)

package.json

{
  "name": "dashboard",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "ws": "^3.3.3"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

πŸ€” Expected Behavior

Parcel bundles up the project without any problem.

😯 Current Behavior

⏳  Building...
Server running at http://localhost:1234
🚨  /usr/local/lib/node_modules/parcel-bundler/node_modules/browserify-zlib/lib/binding.js: Unknown plugin "transform-es2015-arrow-functions" specified in "/usr/local/lib/node_modules/parcel-bundler/node_modules/browserify-zlib/package.json" at 0, attempted to resolve relative to "/usr/local/lib/node_modules/parcel-bundler/node_modules/browseri    at /usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at JSAsset.parse (/usr/local/lib/node_modules/parcel-bundler/src/assets/JSAsset.js:55:20)
    at JSAsset.parseIfNeeded (/usr/local/lib/node_modules/parcel-bundler/src/Asset.js:46:29)
    at <anonymous>

πŸ’ Possible Solution

No idea. The project is too small for anything to cause this error.

πŸ”¦ Context

Just trying out parcel to bundle the simplest project.

🌍 Your Environment

| Software | Version(s)
| ---------------- | ----------
| Parcel | 1.2.0
| Node | v9.3.0
| npm/Yarn | npm 5.6.0
| Operating System | OSX 10.13.2

Most helpful comment

@DeMoorJasper @sergi im having the same issue... same situation

All 21 comments

yarn add babel-plugin-transform-es2015-arrow-functions --dev
OR
npm install babel-plugin-transform-es2015-arrow-functions --save-dev
Should fix your issue

Please close the issue if this resolved the bug

Hi, this does not resolve the issue:

❯ npm install babel-plugin-transform-es2015-arrow-functions --save-dev
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
added 4 packages in 5.364s

❯ parcel index.html
⏳  Building...
Server running at http://localhost:1234
🚨  /usr/local/lib/node_modules/parcel-bundler/node_modules/browserify-zlib/lib/binding.js: Unknown plugin "transform-es2015-arrow-functions" specified in "/usr/local/lib/node_modules/parcel-bundler/node_modules/browserify-zlib/pack    at /usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at JSAsset.parse (/usr/local/lib/node_modules/parcel-bundler/src/assets/JSAsset.js:55:20)
    at JSAsset.parseIfNeeded (/usr/local/lib/node_modules/parcel-bundler/src/Asset.js:46:29)
    at <anonymous>

@DeMoorJasper @sergi im having the same issue... same situation

If someone could provide a basic project with this bug than i could confirm if its a bug or how to actually fix this

Sent with GitHawk

@cristiandley That example repo uses pug, which is not supported by default in parcel, i'm a bit confused at how this should work? Could u provide the correct run scripts and dependancies in package.json fit to parcel, because this seems like a webpack app?

@DeMoorJasper well... my bad ... yes it was a dirty repo. Now i updated it. Aboug pug i thought Parcel built everything, im sorry.

I removed everything that should not work... and should not be there and this is the new error...

/usr/lib/node_modules/parcel-bundler/bin/cli.js:84
async function bundle(main, command) {
      ^^^^^^^^
SyntaxError: Unexpected token function
    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.runMain (module.js:604:10)
    at run (bootstrap_node.js:393:7)
    at startup (bootstrap_node.js:150:9)
error Command failed with exit code 1.

That's a little compatibility error with node 6 and 7 atm, updating to node 8 would fix this.
@cristiandley

@DeMoorJasper here's a minimal repo that reproduces the issue for me: https://github.com/sergi/parcel_testcase

Encountered the issue as well.
It just happened when I tried to import twitter lib into my repo.


btw, I'm using [email protected], and I don't think it's nodejs related.
plz reopen this issue since npm install babel-plugin-transform-es2015-arrow-functions --save-dev doesn't solve the problem.

Repopening as per @cyyyu’s request…

@cyyyu Can you please provide your Parcel version and an example repo so we can reproduce the issue

@davidnagli sure, I'm using [email protected]

A super minimal repo includes 3 files for reproduction. As I mentioned I had only one lib(twitter) imported.

Btw if it matters, I have [email protected] and [email protected]

index.html

<html>
<body>
  <script src="./index.js"></script>
</body>
</html>

index.js

import Twitter from 'twitter'
const client = new Twitter({
  //...
})

package.json

{
  "dependencies": {
    "twitter": "^1.7.1"
  }
}

The above example gives me the following:

Couldn't find preset "es2015" relative to directory "C:\\Source\\parcel-bundler\\parcel-test\\325\\node_modules\\hawk"

Running the following fixes the error:

npm install --save babel-preset-es2015

@brandon93s emmm... while it gives me this.

⏳  Building...
Server running at http://localhost:1234
🚨  /usr/local/lib/node_modules/parcel-bundler/node_modules/browserify-zlib/lib/binding.js: Unknown plugin "transform-es2015-arrow-functions" specified in "/usr/local/lib/node_modules/parcel-bundler/node_modules/browserify-zlib/package.json" at 0, attempted to resolve relative to "/usr/local/lib/node_mod    at /usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/usr/local/lib/node_modules/parcel-bundler/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at JSAsset.parse (/usr/local/lib/node_modules/parcel-bundler/src/assets/JSAsset.js:55:20)
    at JSAsset.parseIfNeeded (/usr/local/lib/node_modules/parcel-bundler/src/Asset.js:46:29)
    at <anonymous>

By investigating for a while I have myself a workaround. This might help anybody who encountered the same problem.

Instead of using parcel globally, I install it locally by npm install --save-dev parcel-bundler.
Then I add a npm script like

  "scripts": {
    "start": "parcel ./index.html"
  }

Also I need preset-es2015 or I will get another issue.

npm install --save-dev babel-preset-es2015

Then use npm start for bundling and everything works.

@cyyyu , your workaround worked for me, but only on development mode. If I run parcel build entry.html I still get the same error.

Hey, any solution for this, I also get this error about missing: transform-es3-member-expre ssion-literals

@sergi
try to run script with --no-cache option or remove .cache folder then running script

parcel src/index.html --no-cache
parcel build src/index.html --no-cache --public-url / -d dist

Hi @lednhatkhanh, it’s similar, I had to install 4 packages when I had the same error:

npm install --save-dev babel-plugin-transform-es3-member-expression-literals
npm install --save-dev babel-plugin-transform-es3-property-literals
npm install --save-dev babel-preset-es2015
npm install --save-dev babel-preset-stage-0

This is probably #13.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Niggler picture Niggler  Β·  3Comments

466023746 picture 466023746  Β·  3Comments

jzimmek picture jzimmek  Β·  3Comments

devongovett picture devongovett  Β·  3Comments

termhn picture termhn  Β·  3Comments