Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requires Babel “7.0.0-0” but was loaded with “6.26.3” #8482

Closed
rayj10 opened this issue Aug 16, 2018 · 50 comments

Comments

@rayj10
Copy link

commented Aug 16, 2018

Bug Report

Current Behavior
Keep getting this and I've tried a bunch of solutions around the forum. This is what I'm getting:

error: bundling 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: "C:\Users\Admin-ESS\Absent\node_modules\@babel\preset-env\lib\index.js")

at throwVersionError (C:\Users\Admin-ESS\Absent\node_modules\@babel\preset-env\node_modules\@babel\helper-plugin-utils\lib\index.js:65:11) 
at Object.assertVersion (C:\Users\Admin-ESS\Absent\node_modules\@babel\preset-env\node_modules\@babel\helper-plugin-utils\lib\index.js:13:11) 
at _default (C:\Users\Admin-ESS\Absent\node_modules\@babel\preset-env\lib\index.js:150:7) 
at C:\Users\Admin-ESS\Absent\node_modules\@babel\preset-env\node_modules\@babel\helper-plugin-utils\lib\index.js:19:12 
at C:\Users\Admin-ESS\Absent\node_modules\metro\node_modules\babel-core\lib\transformation\file\options\option-manager.js:317:46 
at Array.map () at OptionManager.resolvePresets (C:\Users\Admin-ESS\Absent\node_modules\metro\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20) 
at OptionManager.mergePresets (C:\Users\Admin-ESS\Absent\node_modules\metro\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
at OptionManager.mergeOptions (C:\Users\Admin-ESS\Absent\node_modules\metro\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14) 
at OptionManager.init (C:\Users\Admin-ESS\Absent\node_modules\metro\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12) 
at File.initOptions (C:\Users\Admin-ESS\Absent\node_modules\metro\node_modules\babel-core\lib\transformation\file\index.js:212:65) 
at new File (C:\Users\Admin-ESS\Absent\node_modules\metro\node_modules\babel-core\lib\transformation\file\index.js:135:24) 
at Pipeline.transform (C:\Users\Admin-ESS\Absent\node_modules\metro\node_modules\babel-core\lib\transformation\pipeline.js:46:16) 
at Object.transform (C:\Users\Admin-ESS\Absent\node_modules\metro\src\transformer.js:135:5) 
at Object.transformCode [as transform] (C:\Users\Admin-ESS\Absent\node_modules\metro\src\JSTransformer\worker\index.js:253:15) 
at execMethod (C:\Users\Admin-ESS\Absent\node_modules\jest-worker\build\child.js:92:29) 
at process.on (C:\Users\Admin-ESS\Absent\node_modules\jest-worker\build\child.js:42:7) 
at process.emit (events.js:180:13) at emit (internal/child_process.js:783:12)

And the problem is I'm not sure what am I suppose to look for here. Any pointers would be greatly appreciated :)

Input Code
This is what my package.json look like atm. not sure if theres any package there that accidentally rely on babel 6...

{
  "name": "Absent",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-preset-react-native-stage-0": "^1.0.1",
    "jest": "^23.5.0",
    "jest-react-native": "^18.0.0",
    "react-test-renderer": "16.3.1"
  },
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "test": "jest"
  },
  "jest": {
    "preset": "react-native"
  },
  "dependencies": {
    "@babel/core": "^7.0.0-rc.1",
    "@babel/preset-env": "^7.0.0-rc.1",
    "@babel/preset-react": "^7.0.0-rc.1",
    "jail-monkey": "^1.0.0",
    "prop-types": "^15.6.2",
    "react": "16.3.1",
    "react-native": "^0.55.4",
    "react-native-device-info": "^0.22.4",
    "react-native-elements": "^0.19.1",
    "react-native-firebase": "^4.3.8",
    "react-native-modal": "^6.5.0",
    "react-native-router-flux": "^4.0.1",
    "react-native-size-matters": "^0.1.2",
    "react-native-vector-icons": "^5.0.0",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-thunk": "^2.3.0"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts/"
    ]
  }
}

Expected behavior/code
For it to give beginner-friendly pointer to what is there to look for specifically

Babel Configuration (.babelrc, package.json, cli command)
babelrc looks like this right now:

{
  "presets": ["@babel/preset-env","@babel/preset-react"],
  "env": {
    "development": {
      "plugins": [
        "transform-react-jsx-source"
      ]
    }
  }
}

Environment

  • Node/npm version: Node v9.11.1/npm 5.8.0
  • OS: Windows 10
@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Aug 16, 2018

Hey @rayj10! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented Aug 17, 2018

We could add run "yarn why babel-core" (when using yarn) or "npx npm-why @babel/helpers" (when using npm) to see why the old version of Babel is installed. to the error message.

@existentialism

This comment has been minimized.

Copy link
Member

commented Aug 17, 2018

@rayj10 likely related to babel-preset-react-native-stage-0, which uses v6 plugins.

@fedebalderas

This comment has been minimized.

Copy link

commented Aug 17, 2018

@rayj10 I think you need to add babel-core: ^7.0.0-bridge.0

Try this:

npm install --save-dev "babel-core@^7.0.0-bridge.0"
@rayj10

This comment has been minimized.

Copy link
Author

commented Aug 18, 2018

@fedebalderas I actually tried using the bridge already with no luck

@existentialism Makes sense, I've read posts saying that sometimes packages may depend on other 'hidden' packages that just wouldn't show on ur package.json unless u know exactly what ur looking for. may I know which package uses the babel-preset-react-native-stage-0 and how u could spot cases like this just for future reference?

@nicolo-ribaudo I'll try that too and see what is the real problem

Thanks everyone for the prompt reply! 😄

@julienw

This comment has been minimized.

Copy link

commented Aug 28, 2018

The babel-core bridge is the right answer there's something about this in babel-upgrade's readme file (look up jest).

@julienw

This comment has been minimized.

Copy link

commented Aug 28, 2018

The documentation in https://babeljs.io/docs/en/v7-migration should likely include this somewhere...

@MikeMitterer

This comment has been minimized.

Copy link

commented Sep 18, 2018

In my case I was using Webstorm with "Node parameters" set to -r babel-register which is definitely wrong. Right is: -r "@babel/register"
capturfiles-20180918_104404

@milesj

This comment has been minimized.

Copy link

commented Sep 19, 2018

For those who are still confused.

Even though they have @babel/core as a dependency, and not babel-core, there is a transitive dependency in the tree that requires babel-core. The babel-core binary (babel) is taking precedence over @babel/cores binary. So when the babel binary (pointing to v6) is executed, and .babelrc is using v7 plugins, the following occurs.

The easiest solution is to have both @babel/core^7.0.0 and babel-core@^7.0.0-bridge.0 dependencies. At least until all transitive deps are off v6.

@kseebrinegar

This comment has been minimized.

Copy link

commented Sep 22, 2018

Im still getting the same error. any1 know how to fix it ?
screen shot 2018-09-22 at 1 32 44 pm

@loganfsmyth

This comment has been minimized.

Copy link
Member

commented Sep 22, 2018

@kseebrinegar You'll need to remove the reference to babel-cli since that conflicts with @babel/cli.

@milesj

This comment has been minimized.

Copy link

commented Sep 22, 2018

And most likely remove babel-preset-env too.

@ruslankhh

This comment has been minimized.

Copy link

commented Oct 14, 2018

I fix this problem with them.

npm i -D jest babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime
// babel.config.js
'use strict';

module.exports = {
  presets: [
    '@babel/preset-env',
    '@babel/preset-react'
  ],
  plugins: [
    '@babel/plugin-transform-modules-commonjs',
    '@babel/plugin-transform-object-assign',
    '@babel/plugin-proposal-class-properties',
    '@babel/plugin-proposal-object-rest-spread'
  ]
};
// jest.config.js
'use strict';

module.exports = {
    transform: {
        '^.+\\.jsx$': 'babel-jest',
        '^.+\\.js$': 'babel-jest'
    }
};
@johnhunter

This comment has been minimized.

Copy link

commented Oct 31, 2018

Lots of helpful suggestions here, thanks.

However, I've upgraded to Babel 7 and continue to have the Requires Babel "^7.0.0-0", but was loaded with "6.26.3" error when running jest tests. From the source in @babel/helper-plugin-utils it looks like I should get 25 lines of stack trace but I don't see enough to discover the root cause. E.g.

at throwVersionError (node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
at Object.assertVersion (node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
at _default (node_modules/@babel/plugin-proposal-class-properties/lib/index.js:81:7)
at node_modules/@babel/helper-plugin-utils/lib/index.js:19:12

Adding the jest transform suggested by @ruslankhh helps somewhat. Without it all tests fail to run but with the transforms tests at least attempt to parse.

Any further input would be much appreciated.

Settings:

.babelrc

{
  "presets": [
    "@babel/preset-react",
    "@babel/preset-env"
  ],
  "plugins": [
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-object-rest-spread",
    "@babel/plugin-transform-runtime",
    "@babel/plugin-transform-async-to-generator",
    "@babel/plugin-transform-object-assign"
  ]
}

package.json

...
"devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/polyfill": "^7.0.0",
    "@babel/runtime": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/plugin-proposal-object-rest-spread": "^7.0.0",
    "@babel/plugin-transform-async-to-generator": "^7.0.0",
    "@babel/plugin-transform-object-assign": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "@babel/standalone": "^7.0.0",
    "babel-core": "^7.0.0-bridge.0",
    "babel-eslint": "^10.0.1",
    "babel-jest": "^23.4.2",
    "babel-loader": "^8.0.4",
    "jest": "^23.6.0",
    "babel-jest": "^23.4.2",
    ...
},
"jest": {
    ...
    "transform": {
      "^.+\\.jsx$": "babel-jest",
      "^.+\\.js$": "babel-jest"
    }
}
@milesj

This comment has been minimized.

Copy link

commented Oct 31, 2018

@johnhunter What is the output of npm ls babel-core? It might be a good idea to delete your lock file and rebuild it.

@johnhunter

This comment has been minimized.

Copy link

commented Nov 1, 2018

Hey @milesj - thanks for the quick response. I've rebuilt package-lock and the problem persists. npm ls for babel-core is:

├── babel-core@7.0.0-bridge.0 
└─┬ jest@23.6.0
  └─┬ jest-cli@23.6.0
    ├─┬ jest-config@23.6.0
    │ └─┬ babel-core@6.26.3 
    │   └─┬ babel-register@6.26.0
    │     └── babel-core@6.26.3 
    └─┬ jest-runtime@23.6.0
      └── babel-core@6.26.3 
@ruslankhh

This comment has been minimized.

Copy link

commented Nov 1, 2018

@johnhunter try rewrite .babelrc to babel.config.js.

@LetsNurtureGit

This comment has been minimized.

Copy link

commented Nov 1, 2018

Any one found any answers?

@julienw

This comment has been minimized.

Copy link

commented Nov 5, 2018

It would be easier if you can push a full example with the issue somewhere on github. FTR it works fine for me.

@nickjuntilla

This comment has been minimized.

Copy link

commented Nov 27, 2018

Got it working by starting a new expo project from scratch and copying over the current dependencies. One notable difference is "babel-preset-expo": "^5.0.0", is in the dev dependencies now.

@dewelloper

This comment has been minimized.

Copy link

commented Nov 28, 2018

It would be easier if you can push a full example with the issue somewhere on github. FTR it works fine for me.

please look at https://github.com/cezerin/cezerin bored me

@loganfsmyth

This comment has been minimized.

Copy link
Member

commented Nov 29, 2018

@dewelloper Look at it where? If the error reproduces with that repo, what are the steps?

@dewelloper

This comment has been minimized.

Copy link

commented Nov 29, 2018

Hi @loganfsmyth in that project i want to upgrade project for hot reloading. For debugging admin side it giving me exception like that "unexpected token" when i research it find out something you have to upgrade babel 6.23 to 7 below my configuration for vscode debugging
{
"type": "node",
"request": "launch",
"name": "Api Debug",
"program": "${workspaceFolder}/src/api/server/index.js",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/babel-node",
"runtimeArgs": ["--nolazy"]
},

After all this thread i have installed core7 and others like that:

"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/node": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-cli": "^6.26.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"jest": "^23.6.0",
"regenerator-runtime": "^0.13.1",
"upgrade": "^1.1.0"
},
"jest": {
"transform": {
"^.+\.jsx$": "babel-jest",
"^.+\.js$": "babel-jest"
}
}

.babelrc:
{
"presets": [
"@babel/preset-react",
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-runtime",
"@babel/plugin-transform-async-to-generator",
"@babel/plugin-transform-object-assign"
]
}

and jest config:
'use strict';

module.exports = {
transform: {
'^.+\.jsx$': 'babel-jest',
'^.+\.js$': 'babel-jest'
}
};

and also i have tryed babel.config too like above...

After all i have tryed 100 different manner but problem same while building project with that switch
npm run build

"scripts": {
"setup": "node -r esm src/api/server/setup.js",
"compile": "babel src/store -d dist/store --presets react --plugins transform-class-properties --quiet",
"compile:watch": "concurrently -n storeWatcher,themeWatcher "babel src/store -d dist/store --presets react --plugins transform-class-properties --watch" "babel theme/src -d theme/dist --presets react --plugins transform-class-properties --watch"",
"webpack:admin": "webpack --config webpack.config.admin.js --mode development",
"webpack:store": "webpack --config webpack.config.store.js --mode development",
"webpack:admin:watch": "webpack --config webpack.config.admin.js --mode development --watch",
"webpack:store:watch": "webpack --config webpack.config.store.js --mode development --watch",
"theme:install": "./scripts/theme-install.sh",
"theme:export": "./scripts/theme-export.sh",
"theme:build": "babel theme/src -d theme/dist --presets react --plugins transform-class-properties --quiet && npm run webpack:store",
"build": "npm run compile && npm run theme:build && npm run webpack:admin",
"build:watch": "concurrently -n compile,webpackStore,webpackAdmin "npm run compile:watch" "npm run webpack:store:watch" "npm run webpack:admin:watch"",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prettier": "prettier --write "src//*.js" "theme//.js"",
"precommit": "lint-staged",
"start-api": "node -r esm src/api/server/index.js",
"start-store": "node -r esm dist/store/server/index.js",
"start": "concurrently npm:start-
",
"clean": "rm -Rf node_modules/ && rm -f ./package-lock.json && npm cache clean -f",
"clean_windows": "IF EXIST node_modules rd /s /q node_modules && IF EXIST package-lock.json DEL package-lock.json && npm cache clean -f",
"rebuild": "npm run clean && npm i",
"rebuild_windows": "npm run clean_windows && npm i"
}

and my persisting error

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.
at throwVersionError (D:\projects\cezerin\pzone\node_modules@babel\helper-plugin-utils\lib\index.js:65:11)

@julienw

This comment has been minimized.

Copy link

commented Nov 29, 2018

I see you still have a "babel-cli": "^6.26.0" that you should replace by @babel/cli.

@dewelloper

This comment has been minimized.

Copy link

commented Nov 29, 2018

oke @julienw again i came up to same point:
Error: Plugin/Preset files are not allowed to export objects, only functions. In D:\projects\cezerin\pzone\node_modules\babel-preset-react\lib\index.js
at createDescriptor (D:\projects\cezerin\pzone\node_modules@babel\core\lib\config\config-descriptors.js:178:11)
at items.map (D:\projects\cezerin\pzone\node_modules@babel\core\lib\config\config-descriptors.js:109:50)

@julienw

This comment has been minimized.

Copy link

commented Nov 29, 2018

can you please push your problematic branch somewhere ? My guess is that you have some left-over configuration somewhere.

@dewelloper

This comment has been minimized.

Copy link

commented Nov 29, 2018

i have pushed now, git@github.com:dewelloper/pzone.git @julienw i have upgraded all project dipendencies

@julienw

This comment has been minimized.

Copy link

commented Nov 29, 2018

I see that you upgraded the devDependencies part but you still have bad dependencies in your dependencies part in package.json.

@dewelloper

This comment has been minimized.

Copy link

commented Nov 29, 2018

@julienw i have added to the normal dependencies even i have tryed before but the problem same. And even i have installed all of them below to normal dependencies

"@babel/cli": "^7.1.5",
"@babel/core": "^7.1.6",
"@babel/node": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"babel-eslint": "^8.2.6",
"babel-plugin-transform-class-properties": "^6.24.1",

problem constant:

babel src/store -d dist/store --presets react --plugins transform-class-properties --quiet

Error: Plugin/Preset files are not allowed to export objects, only functions. In D:\projects\cezerin\pzone\node_modules\babel-preset-react\lib\index.js
at createDescriptor (D:\projects\cezerin\pzone\node_modules@babel\core\lib\config\config-descriptors.js:178:11)
at items.map (D:\projects\cezerin\pzone\node_modules@babel\core\lib\config\config-descriptors.js:109:50)

you can try it by just writing => npm run build

@jose2007kj

This comment has been minimized.

Copy link

commented Dec 11, 2018

I am having this same issue, please help
My package.json file is as follows

 "dependencies": {
    "@babel/cli": "^7.0.0-beta.51",
    "@babel/core": "^7.0.0-beta.51",
    "@babel/polyfill": "^7.0.0-beta.51",
    "body-parser": "^1.18.3",
    "classnames": "^2.2.6",
    "cookie-parser": "^1.4.3",
    "express": "^4.16.4",
    "express-graphql": "^0.6.12",
    "express-jwt": "^5.3.1",
    "graphql": "^0.13.2",
    "history": "^4.7.2",
    "isomorphic-style-loader": "^4.0.0",
    "jsonwebtoken": "^8.3.0",
    "node-fetch": "^2.1.2",
    "normalize.css": "^8.0.0",
    "passport": "^0.4.0",
    "passport-facebook": "^2.1.1",
    "pretty-error": "^2.1.1",
    "prop-types": "^15.6.1",
    "query-string": "^6.1.0",
    "react": "^16.4.1",
    "react-dom": "^16.4.1",
    "sequelize": "^4.37.10",
    "serialize-javascript": "^1.5.0",
    "source-map-support": "^0.5.6",
    "sqlite3": "^4.0.0",
    "universal-router": "^6.0.0",
    "whatwg-fetch": "^2.0.4"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0-beta.51",
    "@babel/node": "^7.0.0-beta.51",
    "@babel/plugin-transform-react-constant-elements": "^7.0.0-beta.51",
    "@babel/plugin-transform-react-inline-elements": "^7.0.0-beta.51",
    "@babel/preset-env": "^7.0.0-beta.51",
    "@babel/preset-flow": "^7.0.0-beta.51",
    "@babel/preset-react": "^7.0.0-beta.51",
    "@babel/preset-stage-2": "^7.0.0-beta.51",
    "autoprefixer": "^8.6.3",
    "babel-core": "^7.0.0-bridge.0",
    "babel-eslint": "^8.2.3",
    "babel-jest": "^23.6.0",
    "babel-loader": "^7.1.4",
    "babel-plugin-transform-react-remove-prop-types": "^0.4.13",
    "browser-sync": "^2.24.4",
    "chokidar": "^2.0.4",
    "css-loader": "^0.28.11",
    "enzyme": "^3.3.0",
    "eslint": "^4.19.0",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-config-prettier": "^2.9.0",
    "eslint-import-resolver-node": "^0.3.2",
    "eslint-loader": "^2.0.0",
    "eslint-plugin-css-modules": "^2.7.5",
    "eslint-plugin-flowtype": "^2.49.3",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-prettier": "^2.6.0",
    "eslint-plugin-react": "^7.9.1",
    "file-loader": "^1.1.11",
    "flow-bin": "^0.74.0",
    "front-matter": "^2.3.0",
    "glob": "^7.1.2",
    "husky": "^0.14.3",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^23.1.0",
    "lint-staged": "^7.2.0",
    "markdown-it": "^8.4.1",
    "mkdirp": "^0.5.1",
    "null-loader": "^0.1.1",
    "opn-cli": "^3.1.0",
    "pixrem": "^4.0.1",
    "pleeease-filters": "^4.0.0",
    "postcss": "^6.0.22",
    "postcss-calc": "^6.0.1",
    "postcss-color-function": "^4.0.1",
    "postcss-custom-media": "^6.0.0",
    "postcss-custom-properties": "^7.0.0",
    "postcss-custom-selectors": "^4.0.1",
    "postcss-flexbugs-fixes": "^3.3.1",
    "postcss-import": "^11.1.0",
    "postcss-loader": "^2.1.5",
    "postcss-media-minmax": "^3.0.0",
    "postcss-nested": "^3.0.0",
    "postcss-nesting": "^6.0.0",
    "postcss-pseudoelements": "^5.0.0",
    "postcss-selector-matches": "^3.0.1",
    "postcss-selector-not": "^3.0.1",
    "prettier": "^1.13.5",
    "raw-loader": "^0.5.1",
    "react-deep-force-update": "^2.1.1",
    "react-dev-utils": "^5.0.1",
    "react-error-overlay": "^4.0.0",
    "react-test-renderer": "^16.4.1",
    "rimraf": "^2.6.2",
    "stylelint": "^9.3.0",
    "stylelint-config-standard": "^18.2.0",
    "stylelint-order": "^0.8.1",
    "svg-url-loader": "^2.3.2",
    "url-loader": "^1.0.1",
    "webpack": "^4.12.0",
    "webpack-assets-manifest": "^3.0.1",
    "webpack-bundle-analyzer": "^2.13.1",
    "webpack-dev-middleware": "^3.1.3",
    "webpack-hot-middleware": "^2.22.2",
    "webpack-node-externals": "^1.7.2"
  },

`

my yarn list babel-core

yarn list v0.27.5 ├─ babel-core@7.0.0-bridge.0 ├─ babel-register@6.26.0 │ └─ babel-core@6.26.3 ├─ jest-config@23.1.0 │ └─ babel-core@6.26.3 └─ jest-runtime@23.1.0 └─ babel-core@6.26.3 Done in 1.54s.

how to solve this

@julienw

This comment has been minimized.

Copy link

commented Dec 11, 2018

I see you still have a too old babel-loader, it should be v8 for babel v7.

@jose2007kj

This comment has been minimized.

Copy link

commented Dec 11, 2018

ok sir,thanks i will try hat

@jose2007kj

This comment has been minimized.

Copy link

commented Dec 11, 2018

@julienw thanks a lot sir,

@tobslob

This comment has been minimized.

Copy link

commented Jan 31, 2019

I was able to solve this Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3" by running "npm uninstall babel-register" and "npm install --sav-dev @babel/register" and added "test": "mocha --require @babel/register -- test", to my "script"

@dewelloper

This comment has been minimized.

Copy link

commented Jan 31, 2019

Last month i've revolved this trick that has taken hard attention from me. :)

I was remember that iş interesting with peer dependencies you should install babel7 as peer deppendency. You can look my cezerin settings from my repo

@tobslob

This comment has been minimized.

Copy link

commented Jan 31, 2019

`import chai from 'chai';
import chaiHttp from 'chai-http';
import { describe, it } from 'mocha';
import app from '../../app';

const chaiAsPromised = require('chai-as-promised');

const { expect } = chai;
chai.use(chaiAsPromised);

chai.use(chaiHttp);

describe('/POST meetup', () => {
it('it should create meetup post with the params', (done) => {
const meetup = {
location: 'Ikeja',
images: ['', ''],
topic: 'Agile development',
body: 'Agile development meetup coming up on saturday',
happeningOn: Date(),
Tags: ['agile', 'learning to code', 'node.js', 'python'],
};
chai.request(app)
.get('/v1/get-all-meetup')
.send(meetup)
.end((err, res) => {
expect(res).to.have.a.status(201);
expect(err).to.have.a.status(422);
expect(res.body).to.be.a('object');
done();
});
});
});
`

[> questionnaira@1.0.0 pretest C:\Users\TOBI\Desktop\Questionnaira
eslint --ignore-path .gitignore .

questionnaira@1.0.0 test C:\Users\TOBI\Desktop\Questionnaira
mocha --require @babel/register -- modules

0 passing (7ms)

PS C:\Users\TOBI\Desktop\Questionnaira>]

My test is neither passing nor failing, what am doing wrong?

@tobslob

This comment has been minimized.

Copy link

commented Jan 31, 2019

`import http from 'http';
import core from './modules/core';
import meetup from './modules/v1/meetup';
import question from './modules/v1/question';
import rsvp from './modules/v1/rsvp';

const express = require('express');

const app = express();
const morgan = require('morgan');

app.use(morgan('combined'));
app.use(core);
app.use(meetup);
app.use(question);
app.use(rsvp);

const server = http.createServer(app);

server.listen(3000, () => {
/* eslint-disable no-console */
console.log('server started...');
});

module.exports = app;
`

@tobslob

This comment has been minimized.

Copy link

commented Jan 31, 2019

@dewelloper
`import express from 'express';
import bodyparser from 'body-parser';
import Joi from 'joi';
import ImageJoi from 'joi-image-extension';
import meetupdb from '../db/db';

const meetup = express();

const ImgJoi = Joi.extend(ImageJoi);

meetup.use(bodyparser.urlencoded({ extended: false }));
meetup.use(bodyparser.json());

/*
*api to create meetup
*/
meetup.post('/v1/create-meetup', (req, res) => {
const data = req.body;
const schema = Joi.object().keys({
location: Joi.string().trim().required(),
images: ImgJoi.image().allowTypes(['png', 'bmp']),
topic: Joi.string().trim().required(),
body: Joi.string().trim().required(),
happeningOn: Joi.date().required(),
Tags: Joi.array().items(Joi.string().trim()),
});

Joi.validate(

data, schema, (err, result) => {
  const meetUp = meetupdb.meetuppost;
  const id = meetupdb.meetuppost.length + 1;
  const createdOn = Date();

  if (err) {
    res.json({
      status: 422,
      message: 'Invalid data, please try-again',
      data: Object.assign({ id, createdOn }, result),
    });
  }
  res.json({
    status: 201,
    message: 'meetup successful created',
    data: Object.assign({ id, createdOn }, result),
  });
  meetUp.push(data);
},

);
});

/*
*api to get all meetup post
*/
meetup.get('/v1/get-all-meetup', (req, res) => {
const result = meetupdb.meetuppost;
if (!result) {
res.status(422).send('an error occur!');
}
res.status(200).json(result);
});

/*

  • api to get specific meetup
    */
    meetup.get('/v1/get-specific-meetup/:id', (req, res) => {
    const requestelement = req.params.id;
    const specMeetup = meetupdb.meetuppost;

// eslint-disable-next-line eqeqeq
const specmeetup = specMeetup.filter(specific => specific.id == requestelement)[0];
if (!specmeetup) {
res.status(404).send('no meetup id match');
}
res.status(200).send(specmeetup);
});

/*

  • An API endpoint to edit meetup post
    */
    meetup.put('/v1/edit-meetup-post/:id', (req, res) => {
    const editId = req.params.id;
    const specMeetup = meetupdb.meetuppost;

// eslint-disable-next-line eqeqeq
const specmeetup = specMeetup.filter(specific => specific.id == editId)[0];

const index = specMeetup.indexOf(specmeetup);
const keys = Object.keys(req.body);

keys.forEach((key) => {
specmeetup[key] = req.body[key];
});

specMeetup[index] = specmeetup;

res.status(202).send(specMeetup[index]);
});

/*
*restful api to delete meetup
*/
meetup.delete('/v1/delete-meetup/:id', (req, res) => {
const deleteId = req.params.id;
const specMeetup = meetupdb.meetuppost;

// eslint-disable-next-line eqeqeq
const specmeetup = specMeetup.filter(specific => specific.id == deleteId);

const index = specMeetup.indexOf(specmeetup);
specMeetup.splice(index, 1);

res.status(200).send(meetup with an id: ${deleteId} has been deleted);
});

module.exports = meetup;
`

@jmayergit

This comment has been minimized.

Copy link

commented Feb 14, 2019

I produced the error Requires Babel “7.0.0-0” but was loaded with “6.26.3” when using debugger in my application. Everything worked fine without debugger but obviously I need to use that.

I have an unusual setup. Gems I use include react-rails and browserify-rails. When running yarn why babel-core (didn't know I was even using it) it showed me babelify as using babel6.x. I was going to use the suggested fix of bridge but I fixed my error before that by uninstalling and installing babelify.

Hope this helps anyone who cares.

@melkishengue

This comment has been minimized.

Copy link

commented Feb 15, 2019

@rayj10 did any of the proposed solutions work for you ? I am facing the same issue...

@rannie-peralta

This comment has been minimized.

Copy link

commented Mar 18, 2019

  • Ensure @babel packages are on the latest version in package.json
  • Remove the package-lock.json and node_modules
  • Reinstall using yarn (not npm)
@milesj

This comment has been minimized.

Copy link

commented Mar 18, 2019

@rannie-peralta You don't need babel-core at all if you're using Babel 7. There's also nothing wrong with Yarn. Your instructions should be updated.

@julienw

This comment has been minimized.

Copy link

commented Mar 18, 2019

@rannie-peralta You don't need babel-core at all if you're using Babel 7.

Actually yes you need it if you're using Jest 23, with this exact version -- but it's not useful anymore with Jest 24, so it will slowly fade into history :)

@ashvin777

This comment has been minimized.

Copy link

commented Jun 2, 2019

Solved - Install Jest@24 to get rid of this error - npm install --save-dev jest@24.8.0

@GavinMoreYoung

This comment has been minimized.

Copy link

commented Jul 13, 2019

maybe you could install global babel-cli, you can try command : npm uninstall -g babel-cli babel-node.you need install @babel/cli and @babel/node.
OR
you can uninstall node and remove npm file in C:\Users\Administrator\AppData\Roaming
i hope i can help you.good luck

@kerrd89

This comment has been minimized.

Copy link

commented Jul 15, 2019

In a test setup.js file, I was importing babel-register instead of @babel/register. If you feel like your dependencies are updated, check to see if you are require the old node_modules namespace anywhere.

@KKica

This comment has been minimized.

Copy link

commented Jul 18, 2019

If you are using babelify v7.3.0 you should change to 9.0.0.
See my answer here

@ssybbvi

This comment has been minimized.

Copy link

commented Jul 27, 2019

yarn add @babel/cli @babel/core @babel/node @babel/preset-env -D

@nileshpandey3

This comment has been minimized.

Copy link

commented Aug 31, 2019

npm install --save-dev "babel-core@^7.0.0-bridge.0"

This helped me and fixed the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.