vercel
vercel copied to clipboard
`vercel dev` not working with Gatsby project
-
Clone the Gatsby example locally
-
Run
yarn develop
to correctly see the Gatsby index route. However, the date is wrong because we're not running the function. -
Kill the dev server and instead run
vercel dev
-
With
23.1.2
(latest stable), we seeNO_RESPONSE_FROM_FUNCTION
displayed
Accessing the API route directly shows a 404
- With
23.1.3-canary.72
(latest canary), it showsCannot find module '/Users/leerob/Developer/vercel/node_modules/vercel-plugin-middleware/dist/index'. Please verify that the package.json has a valid "main" entry
in the browser.
I realized this was only for Node 17 when looking at the stack trace:
Error: Cannot find module '/Users/leerob/Developer/vercel/node_modules/vercel-plugin-middleware/dist/index'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:353:19)
at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at Object.loadCliPlugins (/Users/leerob/.nvm/versions/node/v17.1.0/lib/node_modules/vercel/dist/index.js:269839:34)
at DevServer.runDevMiddleware (/Users/leerob/.nvm/versions/node/v17.1.0/lib/node_modules/vercel/dist/index.js:261137:46)
at DevServer.serveProjectAsNowV2 (/Users/leerob/.nvm/versions/node/v17.1.0/lib/node_modules/vercel/dist/index.js:261205:38)
at Server.DevServer.devServerHandler (/Users/leerob/.nvm/versions/node/v17.1.0/lib/node_modules/vercel/dist/index.js:261107:17) {
code: 'MODULE_NOT_FOUND',
path: '/Users/leerob/Developer/vercel/node_modules/vercel-plugin-middleware/package.json',
requestPath: 'vercel-plugin-middleware'
}
Latest canary works with Node 16 ✅ But then latest stable throws this error...
Error: socket hang up
at connResetException (internal/errors.js:639:14)
at Socket.socketOnEnd (_http_client.js:499:23)
at Socket.emit (events.js:412:35)
at Socket.emit (domain.js:475:12)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
It's also important to mention this example works correctly when deployed.
I think this is related https://github.com/vercel/vercel/issues/7306
Hey, @leerob. I think the easiest way to check if the issues are related is if you (temporarily) remove ::1 localhost
from your hosts
file and see if vc dev
works correctly without it.