Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch is not defined #676

Open
toohandsome opened this issue Jan 1, 2024 · 4 comments
Open

fetch is not defined #676

toohandsome opened this issue Jan 1, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@toohandsome
Copy link

toohandsome commented Jan 1, 2024

Describe the issue

when i select flash , it will show a error

using serial port COM3 at 1500000
esptool: C:\Users\Administrator\.espressif\python_env\idf5.1_py3.11_env\Scripts\esptool.py
fetch https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32c3_bare-0x0.bin
F:\esp32\node_modules\@devicescript\cli\built\devicescript-cli.cjs:490875
    const resp = await fetch(dlUrl);
                 ^

ReferenceError: fetch is not defined
    at fetchFW (F:\esp32\node_modules\@devicescript\cli\built\devicescript-cli.cjs:490875:18)
    at async flashESP32 (F:\esp32\node_modules\@devicescript\cli\built\devicescript-cli.cjs:490730:21)

Environment

vscode: 1.85.1
extension: 2.15.23
devsVersion: v2.15.23
runtimeVersion: v2.15.23
nodeVersion: v16.17.0

Sources

  • src/main.ts}
import * as ds from "@devicescript/core"

setInterval(async () => {
    console.log(":)")
}, 1000)

Devices

interaction_mode: 0
auto_connect: false
reset_in: false
last_reset_in_time: 0
transport:
web: connected
device:
id: VX12 (0xca7adf6c60073afc)
product: ? (0x?)
firmware_version:
uptime:
stats: announce 461, drop 0, restart 0
services:
infrastructure (0x1e1589eb)
proxy (0x16f19949)

Screenshots
recording

@toohandsome toohandsome added the bug Something isn't working label Jan 1, 2024
@toohandsome
Copy link
Author

I konw it's why , node version need 18+; but document is require16+....
i update node version to 20, it's solved.
but i have a new problem.

PS F:\esp32> node_modules\.bin\devicescript.cmd flash --board esp32c3_bare --refresh --install
using devs: v2.15.23, runtime: v2.15.23, node: v20.10.0 from F:\esp32\node_modules\@devicescript\cli\built
using serial port COM3 at 1500000
esptool: C:\Users\Administrator\.espressif\python_env\idf5.1_py3.11_env\Scripts\esptool.py
fetch https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32c3_bare-0x0.bin
saved .devicescript/cache/devicescript-esp32c3-esp32c3_bare-0x0.bin 1282048 bytes
run: C:\Users\Administrator\.espressif\python_env\idf5.1_py3.11_env\Scripts\esptool.py --port COM3 --baud 1500000 write_flash 0x0 .devicescript/cache/devicescript-esp32c3-esp32c3_bare-0x0.bin
node:internal/errors:563
    ErrorCaptureStackTrace(err);
    ^

Error: spawn UNKNOWN
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at F:\esp32\node_modules\@devicescript\cli\built\devicescript-cli.cjs:490903:49
    at new Promise (<anonymous>)
    at runTool (F:\esp32\node_modules\@devicescript\cli\built\devicescript-cli.cjs:490895:10)
    at runEsptool (F:\esp32\node_modules\@devicescript\cli\built\devicescript-cli.cjs:490803:23)
    at flashESP32 (F:\esp32\node_modules\@devicescript\cli\built\devicescript-cli.cjs:490745:28) {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'spawn'
}

Node.js v20.10.0

@pelikhan
Copy link
Member

pelikhan commented Jan 2, 2024

I've pushed a new version (2.16.0) that should require node v20+.

Do you have esptool installed (see https://microsoft.github.io/devicescript/devices/esp32#requirements )?

@pelikhan pelikhan self-assigned this Jan 2, 2024
@toohandsome
Copy link
Author

toohandsome commented Jan 3, 2024

I've pushed a new version (2.16.0) that should require node v20+.

Do you have esptool installed (see https://microsoft.github.io/devicescript/devices/esp32#requirements )?

yes , I have installed esptool

image
image

@pelikhan
Copy link
Member

pelikhan commented Feb 1, 2024

it seems that we are launching esptool.py instead of esptool. were you able to flash manually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants