BuilderIO / micro-agent

An AI agent that writes (actually useful) code for you
https://www.builder.io/blog/micro-agent
MIT License
2.61k stars 206 forks source link

SyntaxError in `execa` package on Node.js v18.14.0 #48

Closed alexkreidler closed 1 month ago

alexkreidler commented 2 months ago

When I run micro-agent -h I get:

file:///mnt/data/pnpm-global/5/.pnpm/execa@9.3.0/node_modules/execa/lib/utils/max-listeners.js:1
import {addAbortListener} from 'node:events';
        ^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'node:events' does not provide an export named 'addAbortListener'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

Node.js v18.14.0

Since execa's supported Node engine versions are only 18.19.0 || >=20.5.0, this CLI won't work on older versions. Might want to add a note to the README or add your own engines field to package.json.

caraya commented 1 month ago

Adding an engines block in micro-agent will not solve the problem since it will not override execa's engines block that only supports the current LTS versions. It's not likely that they will change it.

Version 9.0.0 has the following breaking change in the release notes

Dropped support for Node.js version <18.19.0 and 20.0.0 - 20.4.0.

Looking at the docs for addAbortListener, it's not an issue of older versions of Node. The experimental API was introduced in Node 20.5.0 and Node 18.18.0 so it won't work with the version of Node you're running, regardless of whether execa or micro-agent work or not.

https://nodejs.org/api/events.html#eventsaddabortlistenersignal-listener

If you're using the latest Node 20 release the API should work and Exceca should be happy without having to make any changes to micro-agent

a20185 commented 1 month ago
image

I am really confused.In README, it was emphasised that micro-agent supports Node V14 or later.However I've tried v14.18.2 、v16.16.0、v18.4.0,none of the versions is supported.

If it only supports Node V20+, why not modify the README?

steve8708 commented 1 month ago

PRs always helpful/encuraged :) i'll go ahead and update, thanks for investigating all

caraya commented 1 month ago

I am really confused.In README, it was emphasised that micro-agent supports Node V14 or later.However I've tried v14.18.2 、v16.16.0、v18.4.0,none of the versions is supported.

If it only supports Node V20+, why not modify the README?

That's not what we're saying at all.

Micro-agent supports Node 14 and higher, although it is beyond me why would you want to use an unsupported version of Node, that's your decision.

Changing supported versions of Node is not trivial. That's usually a major change according to semantic versioning and would require a new major release (since it may break deployments using the package), not just a change in the README file.

If you're having problems with addAbortListener you should run Node 20.5.0 or 18.18.0 where the feature was introduced. That has nothing to do with micro-agent.

If you're getting other errors, please report them as separate issues to make it easier for the maintainers to triage them.