I am trying to install Babel and two other plugins to use with Webpack and Reactjs.
I used this command :
npm i babel-loader babel-preset-es2015 babel-preset-react -S
which gives me warning messages :
UNMET PEER DEPENDENCY babel-core@^6.0.0
and this one :
npm WARN [email protected] requires a peer of babel-core@^6.0.0 but none was installed.
And an error message :
ERROR in Cannot find module 'babel-core'
How can I fix this ?
Thanks in advance.
You can also check the version of babel-cli by finding the babel-cli folder in node_modules and looking at the version property of the package. json that is at the base of that folder. If babel-cli was installed globally via -g flag of npm install , you could check the version by executing command babel --version .
The reason behind this is that npm deprecated auto-installing of peerDependencies since npm@3, so required peer dependencies like babel-core and webpack must be listed explicitly in your package.json
.
All that you need to do is to install babel-core.
Just added this line:
"babel-core": "^6.0.0",
to my package.json file (dependency), tried the same command again and the warning message vanished.
EDIT: To get rid of this error:
ERROR in Cannot find module 'babel-core'
I installed babel-core along with the other plugins using this command:
npm i babel-core babel-loader babel-preset-es2015 babel-preset-react -S
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With