Brand new test, EPIPE error trying to run local environment

I’m going through the guide here (/workers/get-started/guide/), and went to run my first project locally. First thing I noticed is, in worker.js, it says:

 * - Run `npm run dev` in your terminal to start a development server

Which won’t work as the script in package.json is start, not dev. I tried that though and got this:

⎔ Starting local server...
[mf:wrn] The latest compatibility date supported by the installed Cloudflare Workers Runtime is "2023-05-18",
but you've requested "2023-06-26". Falling back to "2023-05-18"...
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit                                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
/home/ray/projects/cloudflare/hello-ray/node_modules/wrangler/wrangler-dist/cli.js:30632
            throw a;
            ^

Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:946:11)
    at Socket._write (node:net:958:8)
    at writeOrBuffer (node:internal/streams/writable:399:12)
    at _write (node:internal/streams/writable:340:10)
    at Writable.write (node:internal/streams/writable:344:10)
    at Runtime.updateConfig (/home/ray/projects/cloudflare/hello-ray/node_modules/miniflare/dist/src/index.js:5125:26)
    at async #assembleAndUpdateConfig (/home/ray/projects/cloudflare/hello-ray/node_modules/miniflare/dist/src/index.js:9140:23)
    at async #init (/home/ray/projects/cloudflare/hello-ray/node_modules/miniflare/dist/src/index.js:8902:5)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Node.js v20.1.0

Any ideas?

2 Likes

Hello :raised_hand: I’m a PM on the Workers team. This looks like an issue of missing dependencies. Since v3, wrangler dev requires libc++ since that is required by the workerd runtime. For more instruction on how to install that, you can see our docs here: Commands · Cloudflare Workers docs

Also, the latest version (v3.2.0) takes care of the compatibility issues mentioned in the docs. As of v3.2.0 wrangler dev should work on macOS 11 and higher, Debian 11/12, and Windows.

I’ve had better luck today working with Workers, but ran into a similar issue when I generated a new worker using the CRON/scheduled example.

I tried to test via wrangler dev --test-scheduled, but that threw an error looking for src/worker.ts. I had selected JavaScript, not TypeScript, so I had to use: wrangler dev src/worker.js --test-scheduled, and got 2 errors that are concerning:

▲ [WARNING] Miniflare 3 does not support CRON triggers yet, ignoring...

It’s just a warning, so maybe it doesn’t matter?

And then it gets:

/home/ray/.nvm/versions/node/v20.1.0/lib/node_modules/wrangler/node_modules/@cloudflare/workerd-linux-64/bin/workerd: error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or directory
✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.

I checked my Ubuntu version, and its 22.04.2, so I should be good.

Ok, I think I get it. Wrangler was installed globally, and locally. I did:

npx wrangler dev src/index.js --test-scheduled

And that seems to work. (Although I do think wrangler should be picking up on .js or .ts)

Last reply, honest. :slight_smile: So I can test my scheduled event, but in the console I get errors because fetch() isn’t exported. It doesn’t seem to stop me from testing, but it feels like something that should be handled.

1 Like

Thanks for the update!

As to JS/TS, when did you select one over the other? Just trying to understand how you got there in the process.

For the fetch() error, it is something we should handle in the event of valid Workers that don’t use it. I’ll make a note to address that.

I selected JS during npm create cloudflare@latest.

1 Like