Next.js: Couldn't find preset "es2015" relative to directory

Created on 1 Nov 2016  路  7Comments  路  Source: vercel/next.js

Hi, I've downloaded the nextgram example and, after run npm install, I tried to execute npm run dev. The error described in the title occurs every time I tried to run the server... Am I missing something? I am using the version 1.0.2

Most helpful comment

Ran into this with Node 7.2 and npm@3 or yarn. Tried adding presets manually which didn't work either. Finally adding the following babel config manually to my package.json solved it:

"babel": {
    "presets": [
      "es2015",
      "react"
    ]
  }

EDIT: Looks like all this was due to .baberlrc in my home folder etc that was causing issues. Removing that solved it

All 7 comments

What version of Node/npm are you using?

I found that when I used Node 4.6/npm 2.x.x, I had the same problem, but when I used yarn I didn't. I think that it might be because under npm 2, a packages' dependencies are installed in an internal node_modules directory (so for example react is found in node_modules/next.js/node_modules/react, whereas with yarn and npm 3.x all packages are installed at the same level. Just a hunch though (and will be totally disproved if you're on npm 3 or yarn.

To fix you can run npm install babel-preset-es2015 --save (and maybe also install babel-preset-react if it still doesn't work). Or update npm npm install npm -g.

You were completely right, thank you. I am using Node 4.x/npm 2.x, so I have to install the babel presets manually.

Closing the issue

Ran into this with Node 7.2 and npm@3 or yarn. Tried adding presets manually which didn't work either. Finally adding the following babel config manually to my package.json solved it:

"babel": {
    "presets": [
      "es2015",
      "react"
    ]
  }

EDIT: Looks like all this was due to .baberlrc in my home folder etc that was causing issues. Removing that solved it

I'm also having this issue running these versions:

Node: v7.9.2
NPM: 3.10.9

馃槩

Thanks @jorilallo that worked for me

I had this issue and following jorilallo's advice, I did "ls -a" and found a .babelrc file on my Desktop. After I deleted that, everything worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nickredmark picture nickredmark  路  60Comments

nvartolomei picture nvartolomei  路  78Comments

timneutkens picture timneutkens  路  72Comments

Timer picture Timer  路  60Comments

Vista1nik picture Vista1nik  路  55Comments