gulp-babel: Cannot find module 'babel-core'
I’ve just updated from 6.1.2 to 7.0.0 and I now get this error message:
[17:08:05] 'requirejs' errored after 68 ms
[17:08:05] Error: Cannot find module 'babel-core'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/.../Client/node_modules/gulp-babel/index.js:7:15)
at Module._compile (module.js:570:32)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 30
- Comments: 29 (3 by maintainers)
Links to this issue
Commits related to this issue
- Adding gulp core `babel-core` is now expected to be a peer dependency. babel/gulp-babel#124 — committed to shramee/gulp-sass-babel by shramee 6 years ago
- Add example of getInitialProps to with-reasonml (#5975) The current reasonml needs an example of how to do getInitialProps. tmepple posted the only known way of doing it in [this comment](https://gi... — committed to vercel/next.js by Enalmada 5 years ago
Install
babel-core
as your dev dependency and it will work.Update
As of babel 7, install the dependency via the following command instead
It wasn’t working for me too, until I read the README. It clearly says:
npm install --save-dev gulp-babel @babel/core @babel/preset-env
👍Babel 6:
npm install --save-dev
The following:Babel 7:
npm install --save-dev
The following:Thank you, this worked. The release notes say:
could you please make it a bit more explicit that something is required from the users? A note in the README would be nice as well.
For anyone finding themselves down this rabbit hole, this comment is the exact opposite of reality. Babel 7 moved to the @babel namespace.
The messaging from
npm
probably isn’t super obvious, but yeah this was a change in 7.0.babel-core
is now expected to be a peer dependency. When I install it on my machine for instance:which tries to convey this, but unless you’re looking for it, it’s pretty easy to miss.
npm i @babel/core
For me the only working solution for Babel 7 was from Babel setup guide. Note the gulp-babel@next
I keep getting an error on windows machine.
The Setup page in the docs on babeljs.io doesn’t mention this either:
If you are using
@babel-core (v7.0+)
you need to upgrade to the latest version ofbabel-loader (v8.0)
simply run this command.npm install -D babel-loader@8.0.0
Thought I’d add my own solution: delete
package-lock.json
and try again.I have this issue crop up from time to time. Deleting
package-lock.json
solves it every time.I could fix it by this link
https://github.com/babel/babel-loader
@AlexanderKozhevin When installing, you need to install that too: https://github.com/babel/gulp-babel/tree/v7-maintenance#install