cli icon indicating copy to clipboard operation
cli copied to clipboard

v17.38.1 and above shows an error with setting up edge environment

Open coaxial opened this issue 10 months ago • 9 comments

Describe the bug

netlify dev runs fine unti v17.38.0 of netlify-cli. If I use v17.38.1 or above, then I'm getting this error:

› Error: There was a problem setting up the Edge Functions environment. To try a manual installation, visit https://ntl.fyi/install-deno.

Full start:

> netlify dev

◈ Netlify Dev ◈
◈ Injecting environment variable values for all scopes
◈ Ignored general context env var: LANG (defined in process)
◈ Ignored general context env var: LANGUAGE (defined in process)
◈ Ignored general context env var: LC_ALL (defined in process)
◈ Setting up local development server
◈ Starting Netlify Dev with Astro
15:19:11 [types] Generated 1ms
15:19:11 [content] Syncing content
15:19:11 [content] Synced content
15:19:11 [vite] Re-optimizing dependencies because lockfile has changed

 astro  v5.3.0 ready in 569 ms

┃ Local    http://localhost:4321/
┃ Network  use --host to expose

15:19:11 watching for file changes...
✔ Waiting for framework port 4321. This can be configured using the 'targetPort' property in the netlify.toml

   ┌─────────────────────────────────────────────────┐
   │                                                 │
   │   ◈ Server now ready on http://localhost:8888   │
   │                                                 │
   └─────────────────────────────────────────────────┘

⠙ Setting up the Edge Functions environment. This may take a couple of minutes.◈ Loaded function getTranslations
◈ Loaded function calculateAllowance
⠹ Setting up the Edge Functions environment. This may take a couple of minutes.◈ Loaded function calculateDate
◈ Loaded function calculateInterim
✖ Setting up the Edge Functions environment. This may take a couple of minutes.
 ›   Error: There was a problem setting up the Edge Functions environment. To try a manual installation, visit https://ntl.fyi/install-deno.

Deno seems to be present:

$ deno --version                                                                                                                     
deno 2.2.0 (stable, release, x86_64-unknown-linux-gnu)                                                                                                                    
v8 13.4.114.9-rusty                                                                                                                                                       
typescript 5.7.3       

I'm using node v20.18.3

Steps to reproduce

  1. Use netlify-cli 18.38.1 or above
  2. Run netlify dev
  3. Get the error message

Configuration

[dev]
  autoLaunch = false
[build]
  command = "astro build"
  functions = "netlify/functions"
  publish = "dist"
[functions]
  node_bundler = "esbuild"
[[redirects]]
  # Serve Plausible as a first-party script
  from = "/js/ascript.js"
  to = "https://plausible.io/js/script.js"
  status = 200
[[redirects]]
  # Also proxy Plausible events
  from = "/api/event"
  to = "https://plausible.io/api/event"
  status = 200
[[redirects]]
  from = "/api/*"
  to = "/.netlify/functions/:splat"
  status = 200
[[plugins]]
  package = "netlify-plugin-minify-html"
[[plugins]]
package = "netlify-plugin-image-optim"

Environment

sh: 1: envinfo: not found

coaxial avatar Feb 19 '25 14:02 coaxial

I've been having the same issue. Thanks, @coaxial, for the workaround.!

stevenmilstein avatar Feb 24 '25 04:02 stevenmilstein

Hi folks. Thanks for reporting this.

Does this happen consistently? If you run netlify dev multiple times in a row, does it fail like this every time?

If I use v17.38.1 or above, then I'm getting this error

To clarify, are you seeing this issue with the latest netlify-cli version (19.0.0)? There have been quite a few releases since 17.38.1. Can you please run npm i -g netlify-cli@latest and try again?

Thanks!

serhalp avatar Feb 24 '25 20:02 serhalp

Same problem. I have had a support ticket open since Jan 31.

With v 17.38.0, the console logs: -Loaded function ... for serverless functions

  • Loaded edge function ... for edge functions.

Above that version:

  • Setting up the Edge Functions environment. This may take a couple of minutes.◈ Loaded function ... for all serverless functions
  • Doesn't load the Edge Functions
  • ` ✖ Setting up the Edge Functions environment. This may take a couple of minutes. › Error: There was a problem setting up the Edge Functions environment. To try a manual installation, visit https://ntl.fyi/install-deno. ``

Deno is installed.

stevenmilstein avatar Feb 24 '25 21:02 stevenmilstein

@serhalp This was happening with any version available above v17.38.0 when I opened the issue.

coaxial avatar Mar 03 '25 17:03 coaxial

In case it is helpful to anyone looking into this, here is the diff between 17.38.0 and 17.38.1 https://github.com/netlify/cli/compare/v17.38.0...v17.38.1

JakeChampion avatar Mar 17 '25 14:03 JakeChampion

I spent a little time this morning (I tried netlify-cli 17.38.0, 17.38.1, and 19.1.4/latest) trying to reproduce using the netlify.toml provided by @coaxial, but I was unable to.

@coaxial, @stevenmilstein, if either of you can provide a minimal reproduction? A link to a repository would be ideal.

I think we still need more information to say for sure, but my first guess here is there's something specific to your environments that isn't interacting well with something in the Netlify CLI. Can you provide more information?

Let's start with:

  • A minimal repro
  • How did you install Deno? (Using the script on their website? A version manager? Something else?)
  • Are you using a version manager like nvm, nodenv, asdf, etc.? (If so, what version of that tool?)
  • Does netlify dev work if you remove your global Deno installation? You'll want to make sure deno is no longer in your PATH. (The Netlify CLI should automatically download Deno for you, which it installs to an internal directory. If a global installation is available, though, it will prefer that one. If we can figure out whether or not it works with an automatic install but not a global one, that might help us zero in on the issue.)
  • Can you provide the result of npx envinfo? (@coaxial , I see the "Environment" section in your original post is empty. If you're using something like asdf you may need to reshim before envinfo will work correctly--I needed to, anyway.)

ndhoule avatar Mar 28 '25 18:03 ndhoule

I'm seeing this error too, however it only started to bother me since version v19.1.6; before that time, it would fail but the server would still run. Since v19.1.6, the error causes netlify-cli dev to exit. When pinning to v19.1.5, the error is ignored (I don't need edge functions so it's fine for my development). Running with --debug, I see:

getBinaryVersion failed Error: Command failed with ETXTBSY: ~/.config/netlify/deno-cli/deno --version
spawn ETXTBSY
    at ChildProcess.spawn (node:internal/child_process:420:11)
    at Object.spawn (node:child_process:753:9)
    at execa (file:///tmp/bunx-1000-netlify-cli@latest/node_modules/@netlify/edge-bundler/node_modules/execa/index.js:88:26)
    at DenoBridge.getBinaryVersion (file:///tmp/bunx-1000-netlify-cli@latest/node_modules/@netlify/edge-bundler/dist/node/bridge.js:50:38)
    at DenoBridge.downloadBinary (file:///tmp/bunx-1000-netlify-cli@latest/node_modules/@netlify/edge-bundler/dist/node/bridge.js:34:46)
    at DenoBridge.getBinaryPath (file:///tmp/bunx-1000-netlify-cli@latest/node_modules/@netlify/edge-bundler/dist/node/bridge.js:137:32)
    at Module.serve (file:///tmp/bunx-1000-netlify-cli@latest/node_modules/@netlify/edge-bundler/dist/node/server/server.js:195:5)
    at prepareServer (file:///tmp/bunx-1000-netlify-cli@latest/node_modules/netlify-cli/src/lib/edge-functions/proxy.ts:229:24)
    at async Promise.all (index 1)
    at file:///tmp/bunx-1000-netlify-cli@latest/node_modules/netlify-cli/src/lib/edge-functions/proxy.ts:145:37 {
  errno: -26,
  code: 'ETXTBSY',
  syscall: 'spawn',
  originalMessage: 'spawn ETXTBSY',
  shortMessage: 'Command failed with ETXTBSY: ~/.config/netlify/deno-cli/deno --version\n' +
    'spawn ETXTBSY',
  command: '~/.config/netlify/deno-cli/deno --version',
  escapedCommand: '"~/.config/netlify/deno-cli/deno" --version',
  exitCode: undefined,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: '',
  cwd: 'REDACTED',
  all: '',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

which implies that the deno binary was open for writing when it was executed. It's already downloaded, so I'm not sure why it would be open for writing. Note that I'm running with bunx, though I don't think that's causing this error.

afranchuk avatar May 02 '25 13:05 afranchuk

I just ran into this same issue today. Downgrading the CLI to v17.38.0 solved the problem for now.

edlucas avatar May 28 '25 21:05 edlucas

Ran into the same issue (#7329), and spent hours trying different Node and netlify-cli versions. I got it to work, sort of,

JeffML avatar Jun 06 '25 07:06 JeffML

Removing ~/.config/netlify/deno-cli and running again managed to fix the issue for me.

arthurfiorette avatar Jun 19 '25 12:06 arthurfiorette

DING DING DING! You get the prize!

Removing the deno-cli folder worked for me as well. I was stuck at [email protected] before, but just now got @20.1.1 working after removing the folder above.

JeffML avatar Jul 31 '25 17:07 JeffML

It seems like that worked for me too, upgraded to [email protected] and removed ~/.config/netlify/deno-cli and no problem running the dev server now.

coaxial avatar Sep 27 '25 14:09 coaxial

Thanks @arthurfiorette !

rm -rf ~/.config/netlify/deno-cli

Worked for me too.

stevenmilstein avatar Oct 21 '25 01:10 stevenmilstein

Hi folks! Thank you for sharing all these reports and thank you @arthurfiorette for sharing that solution.

We've just released v23.9.3 which vastly improves the usefulness of this error message, notably by recommending clearing that directory.

Please try upgrading (npm install -g netlify-cli@latest) and let us know if that helps!

I'm going to close this issue. If you run into this again and aren't able to self-heal with the printed instructions, please open a new issue and share the full output (which will now be a detailed error message that will help us help you way better!). Thanks!

serhalp avatar Oct 22 '25 21:10 serhalp