Preact-cli: Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3"

Created on 21 Sep 2019  ยท  3Comments  ยท  Source: preactjs/preact-cli



I'm using preact-cli version 2.2.1

Do you want to request a _feature_ or report a _bug_?
bug

What is the current behavior?

yarn start is throwing an error if I'm adding jest into my node-modules. I'm putting error message below:

โœ– ERROR (webpack)-dev-server/client/index.js
Module build failed: Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3".
 If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. 
Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. 
(While processing preset: "/file-path/node_modules/@babel/preset-env/lib/index.js")

If the current behaviour is a bug, please provide the steps to reproduce.
adding jest and enzyme testing library into my package is throwing an error. Attaching my package.json:

{
  "private": true,
  "name": "my-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "start": "if-env NODE_ENV=production && npm run -s serve || npm run -s dev",
    "build": "preact build",
    "serve": "preact build && preact serve",
    "dev": "preact watch",
    "lint": "eslint src"
  },
  "eslintConfig": {
    "extends": "eslint-config-synacor",
    "rules": {
      "no-unused-vars": "warn",
      "react/sort-comp": "off",
      "lines-around-comment": "off",
      "react/prefer-stateless-function": "off"
    }
  },
  "eslintIgnore": [
    "build/*"
  ],
  "devDependencies": {
    "@babel/core": "^7.6.0",
    "@babel/plugin-proposal-class-properties": "^7.5.5",
    "@babel/plugin-proposal-export-default-from": "^7.5.2",
    "@babel/plugin-proposal-export-namespace-from": "^7.5.2",
    "@babel/plugin-proposal-object-rest-spread": "^7.5.5",
    "@babel/preset-env": "^7.6.0",
    "@babel/preset-flow": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "@stencil/core": "^1.4.0",
    "enzyme": "^3.10.0",
    "enzyme-adapter-preact-pure": "^2.0.2",
    "eslint": "^4.5.0",
    "eslint-config-synacor": "^1.1.0",
    "if-env": "^1.0.0",
    "preact-cli": "^2.0.0"
  },
  "dependencies": {
    "preact": "^8.5.2",
    "preact-compat": "^3.17.0",
    "preact-render-to-string": "^4.1.0",
    "preact-router": "^2.5.5",
    "preact-material-components": "^1.4.3"
  }
}

What is the expected behaviour?
yarn start should start my webpack-dev server

If this is a feature request, what is motivation or use case for changing the behaviour?

Please mention other relevant information.

Please paste the results of preact info here.

preact info

         โ–„โ–„
     โ–„โ–„โ–“โ–“โ–“โ–“โ–“โ–“โ–„โ–„
  โ–„โ–ˆโ–€โ–€โ–ˆโ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–€โ–€โ–ˆโ–„โ–„
โ–โ–“โ–Œโ–โ–“โ–“โ–“โ–’โ–„ โ–€โ–„โ–„โ–“โ–“โ–“โ–Œโ–โ–“โ–Œ 
โ–โ–“โ–“โ–„โ–€โ–“โ–€ โ–„โ–“โ–“โ–„โ–„โ–€โ–“โ–“ โ–“โ–“โ–Œ 
โ–โ–“โ–“โ–“โ–Œ โ–’โ–“โ–Œ  โ–โ–“โ–“  โ–“โ–“โ–“โ–Œ preact-cli 2.2.1
โ–โ–“โ–“ โ–’โ–“โ–„โ–„โ–€โ–“โ–“โ–€ โ–„โ–“โ–“ โ–“โ–“โ–Œ
โ–โ–“โ–Œโ–โ–“โ–“โ–“โ–€โ–€โ–„โ–„โ–€โ–€โ–“โ–“โ–“โ–Œโ–โ–“โ–Œ
  โ–€โ–ˆโ–„โ–„โ–’โ–“โ–“โ–“โ–“โ–“โ–“โ–’โ–„โ–„โ–’โ–€
      โ–€โ–“โ–“โ–“โ–“โ–“โ–“โ–€โ–€
         โ–€โ–€
For help with a specific command, enter:
  preact help [command]

Commands:
  create [template] [dest]  Create a new application.
  build [src] [dest]        Create a production build in build/
  watch [src]               Start a development live-reload server.
  serve [dir]               Start an HTTP2 static fileserver.
  list                      List all official templates

Options:
  -h, --help  Show help                                                [boolean]

Unknown argument: info

github repo : https://github.com/ajay28kumar/jest-redux

Most helpful comment

@prateekbh is there any way to work around things? I want to upgrade my preact to 10.x.x. If there is any postinstall script or any workaround in my system to get it done with preact-cli

All 3 comments

This is because the templates still refer cli V2.
This will be corrected as soon as we hit stable

@prateekbh is there any way to work around things? I want to upgrade my preact to 10.x.x. If there is any postinstall script or any workaround in my system to get it done with preact-cli

CLI v2.2.1 hasn't been updated for long.

@ajay28kumar can you give preact-cli@rc a try and see if you are still facing this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raphaelbauer picture raphaelbauer  ยท  3Comments

thangngoc89 picture thangngoc89  ยท  3Comments

ethanwu10 picture ethanwu10  ยท  3Comments

haggen picture haggen  ยท  3Comments

oren picture oren  ยท  3Comments