I have problems using next/head with Nextjs and SSR, it seems to be an internal server problem, how do I solve it?

Nov 28, 02:21:06 PM: c060db51 ERROR ⨯ Error: Cannot find module ‘next/dist/server/future/route-modules/pages/vendored/contexts/amp-context’
Require stack:

  • /var/task/node_modules/next/dist/shared/lib/head.js
  • /var/task/node_modules/next/head.js
  • /var/task/.next/server/pages/index.js
  • /var/task/node_modules/next/dist/server/require.js
  • /var/task/node_modules/next/dist/server/next-server.js
  • /var/task/.netlify/functions-internal/___netlify-handler/___netlify-handler.js
  • /var/task/___netlify-handler.js
  • /var/runtime/index.mjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at /var/task/node_modules/next/dist/server/require-hook.js:54:36
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at mod.require (/var/task/node_modules/next/dist/server/require-hook.js:62:32)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object. (/var/task/node_modules/next/dist/shared/lib/head.js:29:34)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions…js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [
    ‘/var/task/node_modules/next/dist/shared/lib/head.js’,
    ‘/var/task/node_modules/next/head.js’,
    ‘/var/task/.next/server/pages/index.js’,
    ‘/var/task/node_modules/next/dist/server/require.js’,
    ‘/var/task/node_modules/next/dist/server/next-server.js’,
    ‘/var/task/.netlify/functions-internal/___netlify-handler/___netlify-handler.js’,
    ‘/var/task/___netlify-handler.js’,
    ‘/var/runtime/index.mjs’
    ]
    }

I think you need to install the package. to be sure can you please share your full log and the site you are experiencing this error?

I also encourage you have a look through this resource? It is a compilation of all of our build and deploy resources. This is a good starting point.

If you have worked through those guides and are still encountering issues please share what you have tried