Parcel: Parcel 2: Expected constructor errors when building or watching

Created on 21 Aug 2019  ยท  10Comments  ยท  Source: parcel-bundler/parcel

Expected constructor errors when building or watching

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

package.json

    "babel-eslint": "10.0.1",
    "babel-preset-airbnb": "3.2.0",
    "babel-loader": "8.0.5",
    "babel-plugin-lodash": "3.3.4",
    "parcel": "2.0.0-alpha.1.1",

// ...
  "browser": "target/assets/main.js",
  "scripts": {
    "dev": "parcel watch app/assets/js/main.js",
    "build": "parcel build app/assets/js/main.js",
  }

babel.config.js

module.exports = function(api) {
  // Cache results until NODE_ENV changes
  api.cache.using(() => process.env.NODE_ENV);

  return {
    "presets": ["@babel/preset-env"],
    "plugins": ["@babel/plugin-syntax-dynamic-import", "lodash"]
  };
};

๐Ÿค” Expected Behavior

Build happens successfully

๐Ÿ˜ฏ Current Behavior

โžœ  play-app-template git:(feature/parcel) โœ— npm run build

> [email protected] build /home/adamwilliams/Documents/Projects/play-app-template
> parcel build app/assets/js/main.js

/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197
        throw new Error(`Expected constructor ${value.$$type} to be registered with serializer to deserialize`);
        ^

Error: Expected constructor 2.0.0-alpha.1.1:NodeFS to be registered with serializer to deserialize
    at value (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197:15)
    at memoizedFn (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:83:13)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:112:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:138:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197
        throw new Error(`Expected constructor ${value.$$type} to be registered with serializer to deserialize`);
        ^

Error: Expected constructor 2.0.0-alpha.1.1:NodeFS to be registered with serializer to deserialize
    at value (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197:15)
    at memoizedFn (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:83:13)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:112:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:138:9)
    at processKey (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:108:20)
    at walk (/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:146:9)
/home/adamwilliams/Documents/Projects/play-app-template/node_modules/@parcel/core/node_modules/@parcel/utils/lib/serializer.js:197
        throw new Error(`Expected constructor ${value.$$type} to be registered with serializer to deserialize`);

๐Ÿ”ฆ Context

Can't use Parcel.

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 2.0.0-alpha.1.1
| Node | v10.15.2
| npm/Yarn | 6.10.3
| Operating System | Ubuntu 19.04

Bug โœจ Parcel 2

All 10 comments

Same issue. node 10.16 and Windows 10.

Could someone please provide a reproduction?

Not a reproduction, but here's a public repo which demonstrates this issue:

https://gitlab.com/shandley/minna-no-nihongo-companion/tree/parcel2

@shanehandley That would be fine as well, but I get this error when running yarn build:
src/activities/noActivity.ts: Missing class properties transform.

Interesting - I have been using npm and the result seems to be different when using yarn - It looks like the reporter was also using npm - I will play around with this a little today.

I got a little further with this by removing anything babel6 specific from my package.json and .babelrc and re-adding the babel 7 equivilent when it errored during build.

I am now seeing the issue described in #3467 I will wait for that merge.

@shanehandley does this error still happen with the latest parcel 2 version and babel 7 plugins?

I've updated to latest parcel2 and am trying to build but have a lot of babel issues to work through...I'll try to come back to this over the next few days.

This specific issue no longer occurs for me, thank you.

Awesome, I'll close this issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Niggler picture Niggler  ยท  3Comments

466023746 picture 466023746  ยท  3Comments

mnn picture mnn  ยท  3Comments

humphd picture humphd  ยท  3Comments

donaldallen picture donaldallen  ยท  3Comments