Reputation: 2114
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.
Upvotes: 24
Views: 23835
Reputation: 2114
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
Upvotes: 6
Reputation: 7072
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.
Upvotes: 23