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
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.
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.
@rayj10 likely related to babel-preset-react-native-stage-0, which uses v6 plugins.
@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"
@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! :smile:
The babel-core bridge is the right answer there's something about this in babel-upgrade's readme file (look up jest).
The documentation in https://babeljs.io/docs/en/v7-migration should likely include this somewhere...
In my case I was using Webstorm with "Node parameters" set to -r babel-register which is definitely wrong. Right is: -r "@babel/register"

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.
Im still getting the same error. any1 know how to fix it ?

@kseebrinegar You'll need to remove the reference to babel-cli since that conflicts with @babel/cli.
And most likely remove babel-preset-env too.
I fix this problem with them.
npm i -D jest babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime
```js
// 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'
]
};
```js
// jest.config.js
'use strict';
module.exports = {
transform: {
'^.+\\.jsx$': 'babel-jest',
'^.+\\.js$': 'babel-jest'
}
};
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"
}
}
@johnhunter What is the output of npm ls babel-core? It might be a good idea to delete your lock file and rebuild it.
Hey @milesj - thanks for the quick response. I've rebuilt package-lock and the problem persists. npm ls for babel-core is:
โโโ [email protected]
โโโฌ [email protected]
โโโฌ [email protected]
โโโฌ [email protected]
โ โโโฌ [email protected]
โ โโโฌ [email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โโโ [email protected]
@johnhunter try rewrite .babelrc to babel.config.js.
Any one found any answers?
It would be easier if you can push a full example with the issue somewhere on github. FTR it works fine for me.
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.
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
@dewelloper Look at it where? If the error reproduces with that repo, what are the steps?
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)
I see you still have a "babel-cli": "^6.26.0" that you should replace by @babel/cli.
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_modulesbabel-preset-react\lib\index.js
at createDescriptor (D:projects\cezerin\pzone\node_modules\@babel\core\libconfigconfig-descriptors.js:178:11)
at items.map (D:projects\cezerin\pzone\node_modules\@babel\core\libconfigconfig-descriptors.js:109:50)
can you please push your problematic branch somewhere ? My guess is that you have some left-over configuration somewhere.
i have pushed now, [email protected]:dewelloper/pzone.git @julienw i have upgraded all project dipendencies
I see that you upgraded the devDependencies part but you still have bad dependencies in your dependencies part in package.json.
@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_modulesbabel-preset-react\lib\index.js
at createDescriptor (D:projects\cezerin\pzone\node_modules\@babel\core\libconfigconfig-descriptors.js:178:11)
at items.map (D:projects\cezerin\pzone\node_modules\@babel\core\libconfigconfig-descriptors.js:109:50)
you can try it by just writing => npm run build
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
โโ [email protected]
โโ [email protected]
โ โโ [email protected]
โโ [email protected]
โ โโ [email protected]
โโ [email protected]
โโ [email protected]
Done in 1.54s.
how to solve this
I see you still have a too old babel-loader, it should be v8 for babel v7.
ok sir,thanks i will try hat
@julienw thanks a lot sir,
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"
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
`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();
});
});
});
`
[> [email protected] pretest C:\Users\TOBI\Desktop\Questionnaira
eslint --ignore-path .gitignore .
[email protected] 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?
`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;
`
@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);
});
/*
// 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);
});
/*
// 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;
`
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.
@rayj10 did any of the proposed solutions work for you ? I am facing the same issue...
package.jsonpackage-lock.json and node_modulesyarn (not npm)@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.
@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 :)
Solved - Install Jest@24 to get rid of this error - npm install --save-dev [email protected]
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
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.
If you are using babelify v7.3.0 you should change to 9.0.0.
See my answer here
yarn add @babel/cli @babel/core @babel/node @babel/preset-env -D
npm install --save-dev "babel-core@^7.0.0-bridge.0"
This helped me and fixed the issue
npm install --save-dev babel-core@^7.0.0-bridge.0
This did not seem to work
Why there are so many different versions of babel: babel-cli, @babel/cli? Which one to use? As I supposed we should use @babel/cli instead of babel-cli?
For those who are still confused.
Even though they have
@babel/coreas a dependency, and notbabel-core, there is a transitive dependency in the tree that requiresbabel-core. Thebabel-corebinary (babel) is taking precedence over@babel/cores binary. So when thebabelbinary (pointing to v6) is executed, and.babelrcis using v7 plugins, the following occurs.The easiest solution is to have both
@babel/core^7.0.0andbabel-core@^7.0.0-bridge.0dependencies. At least until all transitive deps are off v6.
@milesj Thank you mister! ๐ฉ
This worked for me, in package.json
"resolutions": {
"babel-core": "7.0.0-bridge.0"
}
I tried all the methods here until my colleague pointed out that I didn't remove another babel v6 package, and so it was still there in package.json. I removed it and installed a few babel v7 packages and it finally worked.
this is my working .babelrc
{
"presets": [
[
"@babel/preset-env"
],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
]
}
this is a part of my working package.json
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.8.4",
"@babel/node": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@babel/preset-react": "^7.8.3",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^25.1.0",
"jest": "^25.1.0",
"nodemon": "^2.0.2",
"standard": "^14.3.1"
},
"dependencies": {
"babel-upgrade": "^1.0.1",
"express": "^4.17.1",
"iso-redux": "^1.3.12",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-redux": "^7.1.3",
"redux": "^4.0.5",
"redux-actions": "^2.6.5"
}
the key working factor for me was that I didn't remove all babel v6 related packages and so it was still conflicting with the new babel v7 stuff.
I hope it will help out someone.
I had a outdated version installed globally that was causing this issue for me.
I used the following to check global dependencies.
npm list -g --depth 0
Found a bable package and I removed it globally.
npm uninstall -g babel-core
Deleted my package-lock.json
Then reinstalled it locally
npm i --save-dev @babel/core
I had the same issue with babel-core. Try using @babel/cli and @babel/core instead of babel-core
My package.json is here. I have remove babel-core and babel-cli from it but still when I am doing npm install I am seeing error: Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". I am not able to understand from where it's getting added. I am new to Node.
{
"name": "nivochartbasedymreports",
"version": "0.1.0",
"private": true,
"dependencies": {
"@antv/data-set": "^0.11.1",
"@babel/cli": "^7.8.4",
"@babel/preset-env": "^7.9.5",
"@babel/register": "^7.9.0",
"@nivo/bar": "^0.61.1",
"@nivo/heatmap": "^0.61.0",
"@nivo/line": "^0.52.1",
"@nivo/pie": "^0.61.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react-app": "^9.1.2",
"d3-scale": "^3.2.1",
"express": "^4.17.1",
"ignore-styles": "^5.0.1",
"node-fetch": "^2.6.0",
"randomcolor": "^0.5.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-funnel-chart": "^0.1.8",
"react-google-charts": "^3.0.15",
"react-scripts": "0.9.5",
"react-tag-cloud": "^1.3.2",
"recharts": "^1.8.5",
"typeface-roboto": "0.0.75"
},
"devDependencies": {
"@babel/core": "^7.9.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
It's not even installed globally:
npm list -g | grep babel
\โ โโโฌ @babel/[email protected]
โ โ โโโฌ @babel/[email protected]
โ โ โโโ @babel/[email protected]
Try running npx nls why babel-core to see where it comes from.
@nicolo-ribaudo
Thank you so much. It got fixed now.
Most helpful comment
@rayj10 I think you need to add babel-core: ^7.0.0-bridge.0
Try this: