Next.js: Upgrading nextjs v9.3.0 to v.9.3.1 causes Error: Cannot find module 'babel-types'

Created on 17 Mar 2020  路  7Comments  路  Source: vercel/next.js

Bug report

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. On an existing nextjs v9.3.0 application
  2. Bump nextjs to v9.3.1 npm install next@latest
  3. run dev next dev

Expected behavior

expected a smooth upgrade

Screenshots

[ error ] ./node_modules/next/dist/client/next-dev.js
[1] Error: Cannot find module 'babel-types'

System information

  • OS: macOS
  • Version of Next.js: 9.3.1

    • @babel/core": "^7.8.7"

  • using .babelrc with next/babel preset
please add a complete reproduction

All 7 comments

I downgraded back to v9.3.0 in the meantime

Hi, I'm not able to reproduce this on a minimal Next.js project so it is most likely specific to your environment/project. Wiping node_modules and re-creating your lockfile (yarn.lock or package-lock) may help resolve this for your project

I'm seeing some node-gyp errors.. I'll verify and come up with a complete repro

I think I found the issue. I am using reasonML based on the nextjs examples.
I figured out that the babel preset of babel-plugin-bucklescript is no longer needed (that's the one requiring babel-types. By removing that preset from .babelrc it fixed the build.

I assume that babel-plugin-bucklescript was using babel-types as a peerDependency from nextjs.. Probably the new nextJS removed that dependency and that's why this babel plugin is crashing

I also noticed that babel-plugin-bucklescript is now deprecated and its repo is archived. Should I open a ticket to update the nextjs reason examples?

I also noticed that babel-plugin-bucklescript is now deprecated and its repo is archived. Should I open a ticket to update the nextjs reason examples?

Yep sure, could be that there's already an open one.

Going to close this issue as it's not related to Next.js, and we can't change anything here. Basically your app worked accidentally previously as that babel plugin was hoisting babel-types.

Was this page helpful?
0 / 5 - 0 ratings