babeljsbabel-preset-env

Requires Babel "^7.0.0-0", but was loaded with "6.26.3" - @babel/preset-env


I get the following error the moment I install @babel/preset-env and try running a node.js file.

Requires Babel "^7.0.0-0", but was loaded with "6.26.3"

Following is the stack trace

(While processing preset: "P:\\Projects\\ReactNative\\apc-c\\node_modules\\@babel\\preset-env\\lib\\index.js")
    at throwVersionError (P:\Projects\ReactNative\apc-c\node_modules\@babel\helper-plugin-utils\lib\index.js:65:11)
    at Object.assertVersion (P:\Projects\ReactNative\apc-c\node_modules\@babel\helper-plugin-utils\lib\index.js:13:11)
    at _default (P:\Projects\ReactNative\apc-c\node_modules\@babel\preset-env\lib\index.js:154:7)
    at P:\Projects\ReactNative\apc-c\node_modules\@babel\helper-plugin-utils\lib\index.js:19:12
    at P:\Projects\node_modules\babel-core\lib\transformation\file\options\option-manager.js:317:46
    at Array.map (<anonymous>)

I have tried a number of this from installing "7.0.0-bridge.0", etc.

Can someone please help. Have spent hours trying to fix this. Thanks


Solution

  • Found the problem. I had a .babelrc file that contained a reference to @babel/preset-env and transform-react-jsx. Removed them and the js file compiled just fine.