preact-cli: Couldn't find preset "es2015" relative to directory

I’m getting an error with a newly created app. I’m just trying to run it after the initial install. Navigating to localhost:8080 I get a 404.

D:\projects\pwa\preact\my-pwa-test>npm start

> my-pwa-test@1.0.0 start D:\projects\pwa\preact\my-pwa-test
> if-env NODE_ENV=production && npm run -s serve || npm run -s dev

  > Development server started at http://localhost:8080
(webpack)-dev-server/client?http://0.0.0.0:8080/
Module build failed: Error: Couldn't find preset "es2015" relative to directory "D:\\projects"
    at D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19
    at Array.map (native)
    at OptionManager.resolvePresets (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
    at OptionManager.mergePresets (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
    at OptionManager.mergeOptions (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
    at OptionManager.init (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
    at File.initOptions (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\index.js:212:65)
    at new File (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\index.js:135:24)
    at Pipeline.transform (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
    at transpile (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-loader\lib\index.js:48:20)
    at D:\projects\pwa\preact\my-pwa-test\node_modules\babel-loader\lib\fs-cache.js:118:18
    at ReadFileContext.callback (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-loader\lib\fs-cache.js:31:21)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:359:13)
 @ multi ./~/preact-cli/lib/lib/entry webpack-dev-server/client?http://0.0.0.0:8080/ webpack/hot/dev-server?http://0.0.0.0:8080/
./~/preact-cli/lib/lib/entry.js
Module build failed: Error: Couldn't find preset "es2015" relative to directory "D:\\projects"
    at D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19
    at Array.map (native)
    at OptionManager.resolvePresets (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
    at OptionManager.mergePresets (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
    at OptionManager.mergeOptions (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
    at OptionManager.init (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
    at File.initOptions (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\index.js:212:65)
    at new File (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\index.js:135:24)
    at Pipeline.transform (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
    at transpile (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-loader\lib\index.js:48:20)
    at D:\projects\pwa\preact\my-pwa-test\node_modules\babel-loader\lib\fs-cache.js:118:18
    at ReadFileContext.callback (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-loader\lib\fs-cache.js:31:21)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:359:13)
 @ multi ./~/preact-cli/lib/lib/entry webpack-dev-server/client?http://0.0.0.0:8080/ webpack/hot/dev-server?http://0.0.0.0:8080/
(webpack)/hot/dev-server.js?http://0.0.0.0:8080/
Module build failed: Error: Couldn't find preset "es2015" relative to directory "D:\\projects"
    at D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19
    at Array.map (native)
    at OptionManager.resolvePresets (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
    at OptionManager.mergePresets (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
    at OptionManager.mergeOptions (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
    at OptionManager.init (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
    at File.initOptions (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\index.js:212:65)
    at new File (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\file\index.js:135:24)
    at Pipeline.transform (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
    at transpile (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-loader\lib\index.js:48:20)
    at D:\projects\pwa\preact\my-pwa-test\node_modules\babel-loader\lib\fs-cache.js:118:18
    at ReadFileContext.callback (D:\projects\pwa\preact\my-pwa-test\node_modules\babel-loader\lib\fs-cache.js:31:21)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:359:13)
 @ multi ./~/preact-cli/lib/lib/entry webpack-dev-server/client?http://0.0.0.0:8080/ webpack/hot/dev-server?http://0.0.0.0:8080/

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 25 (17 by maintainers)

Most upvoted comments

Removing .babelrc from users home directory “fixes” this. Hmm maybe a babel-core problem?

I tracked down the issue. 🎉 Will open a PR tomorrow.

In the meantime @thangngoc89, you can just npm install babel-preset-es2015. This isn’t the fix, but it’s a faster way to fix your errors without manually deleting .babelrc files.