next.js: Error after upgrading from 9.3.6 to 9.4
Bug report
Describe the bug
Upgrading next
from 9.3.6
to 9.4.0
, then running npm run dev
is throwing an error.
To Reproduce
Upgrade next.js + npm run dev
.
Screenshots
error - ./node_modules/next/dist/next-server/lib/side-effect.js
Module not found: Can't resolve '@babel/runtime/helpers/assertThisInitialized' in '/Users/aroca/front/node_modules/next/dist/next-server/lib'
Error: Cannot find module '/Users/aroca/front/.next/server/static/development/pages/_document'
Require stack:
- /Users/aroca/front/node_modules/next/dist/next-server/server/load-components.js
- /Users/aroca/front/node_modules/next/dist/next-server/server/api-utils.js
- /Users/aroca/front/node_modules/next/dist/next-server/server/next-server.js
- /Users/aroca/front/node_modules/next/dist/server/next.js
- /Users/aroca/front/server/server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1014:15)
at Function.Module._resolveFilename (/Users/aroca/front/node_modules/module-alias/index.js:49:29)
at Function.Module._load (internal/modules/cjs/loader.js:884:27)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.loadComponents (/Users/aroca/front/node_modules/next/dist/next-server/server/load-components.js:24:25)
at DevServer.findPageComponents (/Users/aroca/front/node_modules/next/dist/next-server/server/next-server.js:567:60)
at DevServer.renderErrorToHTML (/Users/aroca/front/node_modules/next/dist/next-server/server/next-server.js:861:33)
at DevServer.renderErrorToHTML (/Users/aroca/front/node_modules/next/dist/server/next-dev-server.js:22:915)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async DevServer.render (/Users/aroca/front/node_modules/next/dist/next-server/server/next-server.js:552:22)
at async Object.fn (/Users/aroca/front/node_modules/next/dist/next-server/server/next-server.js:402:17)
at async Router.execute (/Users/aroca/front/node_modules/next/dist/next-server/server/router.js:134:32)
at async DevServer.run (/Users/aroca/front/node_modules/next/dist/next-server/server/next-server.js:517:29)
at async DevServer.handleRequest (/Users/aroca/front/node_modules/next/dist/next-server/server/next-server.js:153:20) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/aroca/front/node_modules/next/dist/next-server/server/load-components.js',
'/Users/aroca/front/node_modules/next/dist/next-server/server/api-utils.js',
'/Users/aroca/front/node_modules/next/dist/next-server/server/next-server.js',
'/Users/aroca/front/node_modules/next/dist/server/next.js',
'/Users/aroca/front/server/server.js'
]
}
As more details, I’m using Preact + custom server.
System information
- OS: macOS
- Version of Next.js: 9.4.0
- Version of Node.js: 14.0.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 17 (12 by maintainers)
@aralroca Have you tried deleting the
.next
directory and runningnpm run dev
again?i have similar error, but cannot find
./next/build-manifest.json
for mine (justcache/
andserver/
folders are created in.next/
, nostatic/
or jsons) trying to reproduce on minimal repo but no luck so far, did anyone find workaround for this?Same @taylorbryant . Doing
rm -rf node_modules package-lock.json .next && npm i && npm run dev
the error stills hapenning.Remove package-lock.json and .next folder it’s work for me
Not a problem! Let us know how Fast Refresh works for you 🙏
@aralroca you seem to be breaking your own compilation in
next.config.js
by aliasing@babel/runtime
to a package that doesn’t exist:I also often encounter errors after upgrade to the new Next.js version. To resolve to remove
yarn.lock
and reinstall.