Closed DamienCassou closed 7 years ago
Install babel-core
as your dev dependency and it will work.
npm install --save-dev babel-core babel-preset-env
As of babel 7, install the dependency via the following command instead
npm install --save-dev @babel/core @babel/preset-env
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:
$ npm i gulp-babel
/private/tmp
├── UNMET PEER DEPENDENCY babel-core@6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc
└─┬ gulp-babel@7.0.0
<< a bunch of stuff I removed >>
npm WARN gulp-babel@7.0.0 requires a peer of babel-core@6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc but none was installed.
which tries to convey this, but unless you're looking for it, it's pretty easy to miss.
Thank you, this worked. The release notes say:
made babel-core a peerDependency instead of dependency and supports v6/v7/(alpha/beta/rc for v7)
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.
Thanks @abbassiddiqi,Thanks, but why I have to install this module by separated.
The Setup page in the docs on babeljs.io doesn't mention this either:
npm install --save-dev gulp-babel
Agreed, the setup page should be updated.
The npm page (for 7.0.1
) and Github README (for the beta version) are up-to-date so I recommend to check them.
@duvan01
Having babel as a peer dependencies allows the main project to pick the version of Babel it wants without waiting for gulp-babel
to be updated. Still, I'd prefer it to work out-of-the box. We may consider a setup where a default Babel is provided but you can supply your own version too.
Install babel-core as your dev dependency and it will work.
this not works for me.
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:
it works
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
👍
I keep getting an error on windows machine.
cannot find module 'babel-core'
@AlexanderKozhevin When installing, you need to install that too: https://github.com/babel/gulp-babel/tree/v7-maintenance#install
@loganfsmyth thanx!
I could fix it by this link
npm i @babel/core
Thanks you so much
Babel 6:
npm install --save-dev
The following:
@babel/cli
@babel/core
@babel/preset-env
Babel 7:
npm install --save-dev
The following:
babel-cli
babel-core
babel-preset-env
@abbassiddiqi thank you very much!it worked
Babel 6:
npm install --save-dev
The following:@babel/cli @babel/core @babel/preset-env
Babel 7:
npm install --save-dev
The following:babel-cli babel-core babel-preset-env
For anyone finding themselves down this rabbit hole, this comment is the exact opposite of reality. Babel 7 moved to the @babel namespace.
For me the only working solution for Babel 7 was from Babel setup guide. Note the gulp-babel@next
npm install --save-dev gulp-babel@next @babel/core @babel/preset-env
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.
still getiing the same error., please help me out. i tried npm install --save-dev gulp-babel @babel/core @babel/preset-env ERROR in ./app/dev/App.jsx Module build failed: Error: Cannot find module 'babel-core' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
sharing my package.json { "name": "CAP-offer-application", "version": "2.8.23", "description": "This is a React single-page-application that will dynamically render a variety of offers and tests on all CAP flows", "author": "Ryan Wessel", "license": "ISC", "repository": { "type": "git", "url": "gitwebdev@awsgitwebdev.aws.synapsegroupinc.com:repos/webdev/webprod-cap.git" }, "dependencies": { "babel-loader": "^7.1.5", "cli-color": "^2.0.0", "colors": "^1.3.3", "diff": "^4.0.1", "file-loader": "^4.2.0", "google-spreadsheet-to-json": "^1.0.0", "gulp-template": "^5.0.0", "html-webpack-plugin": "^3.0.6", "i": "^0.3.6", "lodash": "^4.17.5", "mkdirp": "^0.5.1", "modernizr": "^3.6.0", "moment": "^2.24.0", "npm": "^6.12.0", "npm-check-updates": "^3.1.25", "prop-types": "^15.6.1", "puppeteer": "^1.14.0", "react": "^16.8.6", "react-dom": "^16.2.0", "react-ga": "^2.4.1", "react-graceful-unmount": "^1.0.7", "react-iframe": "^1.8.0", "react-loadable": "^5.3.1", "react-onclickoutside": "^6.7.1", "react-redux": "^7.1.1", "react-router": "^5.1.2", "react-router-dom": "^5.1.2", "react-slick": "^0.25.2", "redux": "^4.0.4", "redux-thunk": "^2.2.0", "scriptjs": "^2.5.8", "slick-carousel": "^1.8.1", "uglifyjs-webpack-plugin": "^2.2.0", "url-loader": "^2.2.0", "webpack": "^3.11.0", "webpack-browser-plugin": "^1.0.20", "webpack-dev-server": "^2.11.2", "webpack-merge": "^4.1.2", "whatwg-fetch": "^3.0.0", "yargs": "^14.2.0" }, "devDependencies": { "@babel/cli": "^7.6.4", "@babel/core": "^7.6.4", "@babel/plugin-proposal-class-properties": "^7.5.5", "@babel/preset-env": "^7.6.3", "@babel/preset-react": "^7.6.3", "babel-eslint": "^8.2.2", "babel-minify": "^0.3.0", "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.7.0", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "babel-preset-stage-2": "^6.24.1", "babel-register": "^6.24.1", "cross-env": "^6.0.3", "css-loader": "^3.2.0", "del": "^5.1.0", "eslint": "^4.18.2", "eslint-config-airbnb": "^16.1.0", "eslint-plugin-import": "^2.9.0", "eslint-plugin-jsx-a11y": "^6.0.3", "eslint-plugin-react": "^7.7.0", "gulp": "^3.9.1", "gulp-awspublish": "^3.3.1", "gulp-babel": "^7.0.1", "gulp-bump": "^3.1.3", "gulp-git": "^2.9.0", "gulp-if": "^2.0.2", "gulp-prompt": "^1.2.0", "gulp-rename": "^1.2.2", "json-loader": "^0.5.7", "modernizr-loader": "^1.0.1", "node-sass": "^4.7.2", "path": "^0.12.7", "prettier-eslint": "^8.8.2", "react-hot-loader": "^4.0.0", "sass-loader": "^8.0.0", "style-loader": "^1.0.0", "webpack-cli": "^3.3.9" }, "scripts": { "install": "npm run install-webpack-dev-server", "install-webpack-dev-server": "npm install -g webpack webpack-dev-server", "prebuild": "gulp clean && gulp bump", "build": "cross-env NODE_ENV=production webpack --config webpack.prod.js", "prepublish": "npm run build", "publish": "gulp publish && gulp git", "push": "npm run publish && gulp sync", "start": "cross-env NODE_ENV=development webpack-dev-server --progress --inline --hot --config webpack.dev.js", "split": "gulp react-split" } }
I keep getting an error on windows machine.
cannot find module 'babel-core'
Just go inside the babel-loader and change the require("babel-core")----to ----require("@babelcore")
Install
babel-core
as your dev dependency and it will work.npm install --save-dev babel-core babel-preset-env
Update
As of babel 7, install the dependency via the following command instead
npm install --save-dev @babel/core @babel/preset-env
After all,do this also .Just go inside the babel-loader and change the require("babel-core")----to ----require("@babelcore")
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.
Only this ^ worked for me.
Still not working. Thanks
If you are using @babel-core (v7.0+)
you need to upgrade to the latest version of babel-loader (v8.0)
simply run this command.
npm install -D babel-loader@8.0.0
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
Thanks @jdavis-software , this one work for me
Thought I'd add my own solution: delete
package-lock.json
and try again. I have this issue crop up from time to time. Deletingpackage-lock.json
solves it every time.Only this ^ worked for me.
Then run npm i
npm install --save-dev babel-core babel-preset-env
Did not work
Did anyone find a solution for this? I've been getting this error a lot: Parsing error: Cannot find module 'next/babel' Require stack:
Make sure that all the Babel plugins and presets you are using are defined as dependencies or devDependencies in your package.json file. It's possible that the missing plugin is loaded by a preset you are using that forgot to add the plugin to its dependencies: you can workaround this problem by explicitly adding the missing package to your top-level package.json.
I've just updated from 6.1.2 to 7.0.0 and I now get this error message: