When I run netlify dev, it doesn’t work and I get this error:
Error - Could not find function 'next-dev'
Here is the error from the console:
◈ Failed to run Edge Function next-dev:
TypeError: Module not found "file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js".
at file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/next-dev/index.js:1:29
at async file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions-serve/dev.js:7:35 {
code: "ERR_MODULE_NOT_FOUND"
}
TypeError: Module not found "file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js".
at file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/next-dev/index.js:1:29
at async file:///C:/Users/Administrator/AppData/Roaming/npm/node_modules/netlify-cli/node_modules/@netlify/edge-bundler/deno/config.ts:12:10 {
code: "ERR_MODULE_NOT_FOUND"
}
When I checked the .netlify/edge-functions folder, the vendor folder doesn’t even exist.
I do not encounter this error when I run netlify dev from an Administrator cmd window.
But now I get this error:
◈ Netlify Dev ◈
◈ No app server detected. Using simple static server
◈ Unable to determine public folder to serve files from. Using current working directory
◈ Setup a netlify.toml file with a [dev] section to specify your dev server settings.
◈ See docs at: https://cli.netlify.com/netlify-dev#project-detection
◈ Running static server from "Next.js"
◈ Setting up local development server
◈ Static server listening to 3999
Nevermind, I’m a dummy. I was running the elevated cmd in the wrong folder.
Running netlify dev in the elevated cmd window inside my project folder gives the same error as the top:
Here is the full output:
Netlify Dev ◈
◈ Setting up local development server
◈ Starting Netlify Dev with custom config
√ Waiting for framework port 3000. This can be configured using the 'targetPort' property in the netlify.toml
┌─────────────────────────────────────────────────┐
│ │
│ ◈ Server now ready on http://localhost:8888 │
│ │
└─────────────────────────────────────────────────┘
◈ Loaded edge function netlify dev handler
◈ Loaded function getServices
◈ Failed to run Edge Function next-dev:
TypeError: Module not found "file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js".
at file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/next-dev/index.js:1:29
at async file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions-serve/dev.js:7:35 {
code: "ERR_MODULE_NOT_FOUND"
}
TypeError: Module not found "file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js".
at file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/next-dev/index.js:1:29
at async file:///C:/Users/Administrator/AppData/Roaming/npm/node_modules/netlify-cli/node_modules/@netlify/edge-bundler/deno/config.ts:12:10 {
code: "ERR_MODULE_NOT_FOUND"
}
▲ Next.js 13.5.4
- Local: http://localhost:3000
- Environments: .env
✓ Ready in 2.3s
◈ Reloading edge functions...
◈ Failed to run Edge Function next-dev:
TypeError: Module not found "file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js".
at file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/next-dev/index.js:1:29
at async file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions-serve/dev.js:7:35 {
code: "ERR_MODULE_NOT_FOUND"
}
TypeError: Module not found "file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js".
at file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/next-dev/index.js:1:29
at async file:///C:/Users/Administrator/AppData/Roaming/npm/node_modules/netlify-cli/node_modules/@netlify/edge-bundler/deno/config.ts:12:10 {
code: "ERR_MODULE_NOT_FOUND"
}
◈ Failed reloading edge function
◈ Reloading edge functions...
◈ Failed to run Edge Function next-dev:
TypeError: Module not found "file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js".
at file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/next-dev/index.js:1:29
at async file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions-serve/dev.js:7:35 {
code: "ERR_MODULE_NOT_FOUND"
}
TypeError: Module not found "file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js".
at file:///C:/Users/Administrator/Next.js/gobetterway/.netlify/edge-functions/next-dev/index.js:1:29
at async file:///C:/Users/Administrator/AppData/Roaming/npm/node_modules/netlify-cli/node_modules/@netlify/edge-bundler/deno/config.ts:12:10 {
code: "ERR_MODULE_NOT_FOUND"
}
◈ Failed reloading edge function
FYI, here is the stack trace which I don’t believe I have posted yet:
Error: Could not find function 'next-dev'
at FunctionChain.getFunction (https://650bfd807b21ed000893e25c--edge.netlify.com/bootstrap/function_chain.ts:255:13)
at FunctionChain.runFunction (https://650bfd807b21ed000893e25c--edge.netlify.com/bootstrap/function_chain.ts:346:23)
at FunctionChain.run (https://650bfd807b21ed000893e25c--edge.netlify.com/bootstrap/function_chain.ts:316:31)
at handleRequest (https://650bfd807b21ed000893e25c--edge.netlify.com/bootstrap/handler.ts:117:34)
at Server. (https://650bfd807b21ed000893e25c--edge.netlify.com/bootstrap/server.ts:42:7)
at Server.#respond (https://deno.land/std@0.170.0/http/server.ts:299:37)
at Server.#serveHttp (https://deno.land/std@0.170.0/http/server.ts:346:20)
at eventLoopTick (ext:core/01_core.js:183:11)
I also started seeing this later this afternoon (earlier this morning was working fine)
Only local development seems to be impacted, preview builds seem ok
Just adding that as of yesterday evening I had this issue. No code changes / updates, ‘netlify dev’ just stopped working. I didn’t have @netlify/plugin-nextjs in my package.json
I can confirm that @aaronupwell workaround fixed it for me temporarily.
I used to have this issue before as well but updating fixed it. I am having the same issue again, just like everyone else. I hope this gets fixed soon as local testing isn’t available.