Closed ghost closed 7 years ago
It looks like you've installed the babel-preset-2015-rollup
, but you're trying to include babel-preset-es2015
.
Double-check that your .babelrc
looks like this:
{
"presets": [ "es2015-rollup" ]
}
That should fix the problem.
@jlengstorf Thanks for the quick response dude. My .babelrc
is in fact:
{
"presets": ["es2015-rollup"]
}
That's odd.
Just in case, try this:
npm prune
npm cache clean
npm install
Then run it again.
For some sanity-checking: .babelrc
is in the app root, along with package.json
, and that's where you're running the Rollup command, right?
I just pruned, cleared cache and installed again and called ./node_modules/.bin/rollup -c
from root and still getting that error.
I went ahead and created a repo if you are interested in checking it out. I'm sure you are busy so no rush.
Also thanks for the write up on rollup.js I know I find it extremely helpful.
I also had that issue and found a fix here: https://github.com/rollup/rollup-plugin-babel/issues/72 Talkbacked it on the youtube post too.
Again, thank you J for the great Rollup course. I learn in lots of places, some are well established and funded organizations and your teaching and course configuration is well above the standard. I'd love it if you would produce one about Ramda and functional JS.
@2474 This is odd, because I just cloned your repo, cleaned my npm cache, and ran ./node_modules/.bin/rollup -c
and... it all worked as expected. Are you on Mac/OS X?
I'm not sure if I've got something locally installed that would change the outcome you're getting, but here's my current setup:
$ node -v
v4.4.5
$ npm -v
3.10.4
$ ./node_modules/.bin/rollup -c
# No error here.
# For the sake of completeness, my globally-installed packages.
$ npm list -g --depth=0
/usr/local/lib
├── bower@1.7.9
├── hexo-cli@1.0.2
├── hugo@0.0.3
├── node-libs-browser@1.0.0
└── npm@3.10.4
But, like @eylon-uk mentioned, rollup/rollup-plugin-babel#72 has a fix. The relevant config is here:
{
"presets": [
[
"es2015",
{
"modules": false
}
]
],
"plugins": ["external-helpers"]
}
I just tried that in your repo and it works as expected. Give it a shot and let me know if it's still causing problems.
I'm:
Node 4.4.5 NPM 2.15.5
OSX Yosemite 10.10.5
I'll try updating NPM and all else, I'll check out the issue @eylon-uk mentioned.
Thanks for looking into this guys!
I have the same issue. node v4.2.2 npm 2.14.7 osx yosemite 10.11.6
The above solution did not work.
First I had to install babel-plugin-external-helpers
.
Then I got the following error:
'babel' plugin: Couldn't find preset "es2015" relative to directory ..
@yonida Just to sanity check: is your .babelrc
in the same directory as node_modules
?
If you haven't already, also try:
npm install --save-dev babel-preset-es2015
That plus the fix in my comment above should get you up and running.
I had the same issue ,
and i modified .babelrc to
{ "presets": [ [ "es2015", { "modules": false } ] ], "plugins": ["external-helpers"] }
and have it fixed.
I try { "presets": [ [ "es2015", { "modules": false } ] ] },it works;
@jlengstorf #12 help me!
我看了以上评论,还是没能解决我的问题!当我运行 npm run dev
还是报这个错误:
Error transforming D:\workSpace\git\rollup-learning\src\scripts\main.js with 'babel' plugin: It look
s like your Babel configuration specifies a module transformer. Please disable it. If you're using t
he "es2015" preset, consider using "es2015-rollup" instead.
@gongph please share your repo. This looks like a configuration error.
Please use the config in this comment and see if it helps.
@gongph Your .babelrc
needs to match the config I've shared with you twice now. Check the previous comments for the correct config.
Any explanation where this is coming from? Tested the repo without modifications. Works on one machine (OS X) fails on the other as described here (Ubuntu 16.04, although I doubt that the OS is the problem). It is pretty frustrating having to add a config addition on specifically for one machine without getting the background.
(P.S.: many thanks for the tutorial)
I wish I knew. I'm thinking this should probably be opened as an issue on rollup/babel-preset-es2015-rollup, because it's intermittent and — at least judging by the errors — shouldn't be happening.
@wellnoidea, would you mind sharing the error code you're getting on the machine that fails? That'll probably be really helpful for the preset's maintainers. Once I have that, I'll open an issue.
@wellnoidea I edited my last comment to mention you, but I'm not sure if it actually notified you. (If so, sorry!)
If it didn't, I'm hoping to get the error code you're getting on the machine that fails. I'd like to open an issue with the babel-preset-es2015-rollup
repo to dig into this, but I don't have the the information they'll need to debug it.
@jlengstorf Sorry for the delay. I'll post code & error by tomorrow.
Checked both machines first runs npm@3.6.0, everything works fine the second one runs npm@2.15.9, install fails with
{ [Error: Cannot find module 'babel-preset-es2015'] code: 'MODULE_NOT_FOUND' }
Error transforming /[...]/rollup-babel/script.js with 'babel' plugin: Cannot find module 'es2015' (While processing preset: "/[...]/rollup-babel/node_modules/babel-preset-es2015-rollup/index.js")
after upgrading npm on the second machine to 3.6.0 installation works just fine
Confirmed. Downgrading to npm 2.15.9, reinstalling the node dependencies via npm will bring the error back. Going up to 3.6.0 again and reinstalling and everything runs just fine.
I tested with this repo and a minimized version: https://github.com/wellnoidea/babel-rollup
Awesome: it's an npm
version issue and not a ghost. :)
That's incredibly helpful. I'll add a note to the article and close this afterward. Very much appreciate your help, @wellnoidea!
The solution is to use a newer version:
npm install --save-dev gulp-babel@7 babel-core babel-preset-env
Having the same issue, I tried all the solution proposed above having no success.
Having the same issue....
ERROR in ./js/app.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'babel-preset-es2015' from 'C:\xampp\htdocs\REACT_PROJECTS\RGR'
at Function.module.exports [as sync] (C:\xampp\htdocs\REACT_PROJECTS\RGR\node_modules\resolve\lib\sync.js:58:15)
at resolveStandardizedName (C:\xampp\htdocs\REACT_PROJECTS\RGR\node_modules\@babel\core\lib\config\files\plugins.js:101:31)
at resolvePreset (C:\xampp\htdocs\REACT_PROJECTS\RGR\node_modules\@babel\core\lib\config\files\plugins.js:58:10)
at loadPreset (C:\xampp\htdocs\REACT_PROJECTS\RGR\node_modules\@babel\core\lib\config\files\plugins.js:77:20)
at createDescriptor (C:\xampp\htdocs\REACT_PROJECTS\RGR\node_modules\@babel\core\lib\config\config-descriptors.js:154:9)
at items.map (C:\xampp\htdocs\REACT_PROJECTS\RGR\node_modules\@babel\core\lib\config\config-descriptors.js:109:50)
at Array.map (
simply change our .babelrc file. Here is the example of new .babelrc file :
npm install --save-dev @babel/preset-env
{
"presets": [
"@babel/preset-env"
]
}
this will do the trick
Have any idea? Seems like
npm install --save-dev babel-preset-es2015-rollup
installed just fine however below still happens.Node: 4.4.5
EDIT: My
.babelrc
is: