question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transpile error: Couldn't find preset

See original GitHub issue

Hi. I’m not able to transpile my es6 code to es5 due to the following error:

Couldn't find preset "es2015" relative to directory

This is my environment:

OS: OS X CLI version 1.2.2
Local version 4.0.0-alpha.2

package.json (partial):

  "devDependencies": {
    "babel-preset-es2015": "^6.16.0",
    "browser-sync": "^2.7.7",
    "connect-history-api-fallback": "^1.1.0",
    "del": "^2.0.2",
    "es6-promise": "^3.1.2",
    "glob-all": "^3.0.1",
    "gulp": "github:gulpjs/gulp#4.0",
    "gulp-autoprefixer": "^3.1.0",
    "gulp-babel": "^6.1.2",
...

I have the following project structure:

|-!deploy |-build |—components |—helpers |—node_modules |—tasks |-src |—assets |—components |—js |-----3rd |-------jspdf |-------lz-string |-----ext-store |-----mod |—libs |—style

My gulpfile is inside my build folder and from here I would like to transpile my JavaScript (es6) files sitting inside src/js folder to my !deploy folder.

I have in installed gulpv4, CLI1.2.2, babel-preset-es2015v6.16.0.

Why does gulp-babel reports:

Couldn't find preset "es2015" relative to directory "/Users/tester/Projects/XXX/src"

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
loganfsmythcommented, Nov 14, 2016

You should be able to change that to

.pipe(babel({
  presets: [
    require('babel-preset-es2015'),
    require('babel-preset-stage-2'),
  ]
}))

We expect the presets to be relative to the file being processed, if they are not, you cannot use the string-based preset lookup.

0reactions
hzoocommented, Jun 2, 2017

Closing this issue as it’s been inactive for several months. Please feel free to open a new issue or leave a comment asking to reopen this issue. Thanks! ✌️

If you just have an usage issue or want help, I would recommend checking out our slack community or StackOverflow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Couldn't find preset "env" relative to directory" - Stack Overflow
Receiving this error message Error: Couldn't find preset "env" relative to directory when i run my project npm run dev or npm run...
Read more >
Error: Couldn't find preset "@babel/preset-env" relative to ...
Hi, I'm trying to run the project locally on my Windows machine. Unfortunately, v-click-outside is trying to resolve preset ...
Read more >
babel/preset-react
This preset always includes the following plugins:
Read more >
Vue Portlet cannot start - Forums - Liferay Community
node_modules/babel-loader/lib/index.js): Error: Couldn't find preset "@babel/preset-env" relative to directory "D:\\project\\portal\\lv-project"
Read more >
Module build failed: Error: Couldn't find preset - 51CTO博客
F:\WebstormProjects\euw\esa>npm install babel-plugin-component -D npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found