BuilderIO / micro-agent

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

it doesnt start working (Windows) #43

Open yjgoh28 opened 4 months ago

yjgoh28 commented 4 months ago

i installed the npm package, but when i try to run micro-agent on my cmd. Nothing appears, i even set an openai-api-key already.

image

Uffynn commented 4 months ago

did you check if you nodejs is updated to the latest version?

Sudococommunity commented 4 months ago

Same problem

tpaulshippy commented 4 months ago

What OS? The screenshot looks like windows. Anyone have this working on windows?

Sudococommunity commented 4 months ago

we are running this windows bro

tpaulshippy commented 4 months ago

Could be the issue.

Uffynn commented 4 months ago

Try to get Linux or MacOS. Windblows in extremely bad in every single sense.

tpaulshippy commented 4 months ago

I don't have a Windows box handy to try to help you out here. I did look at the packaging library used (pkgroll) and it is sponsored by Microsoft so you would think it would work. Perhaps it has to be built on Windows? Have you tried using WSL (Linux on Windows)?

mdsitton commented 4 months ago

I also cannot get it running under windows, so probably good idea to rename this issue to something more descriptive.

mdsitton commented 4 months ago

Additionally i have a few other things not being shown in the original post here:

PS H:\testdir> micro-agent
(node:32412) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

|
—  Stopping.

PS H:\testdir> micro-agent update

Running: npm update -g @builder.io/micro-agent

(node:39352) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
npm error code 1
npm error path C:\Users\matth\AppData\Local\pnpm\store\v3\tmp\_tmp_28416_cb68f52debc1cc36bd616b3bfe40a5e4
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c husky install
npm error 'husky' is not recognized as an internal or external command,
npm error operable program or batch file.
npm error A complete log of this run can be found in: C:\Users\matth\AppData\Local\npm-cache\_logs\2024-06-27T20_07_37_234Z-debug-0.log
LucasOscarSimon commented 4 months ago

I don't have a Windows box handy to try to help you out here. I did look at the packaging library used (pkgroll) and it is sponsored by Microsoft so you would think it would work. Perhaps it has to be built on Windows? Have you tried using WSL (Linux on Windows)?

I tried with docker over wsl 2 and worked, but it's a little strange because I asked for a python app and wrote a TypeScript one. micro-agent

LucasOscarSimon commented 4 months ago

I tried to keep it as simple as possible just for testing purposes and asked it to write a python app that get real-time exchange rates from an API and allow users to convert between different currencies. As you can see in the above image it did what I asked for but it wrote the code in TypeScript. Is there anything that I'm missing here? Thanks for your help guys and great idea by the way!

tpaulshippy commented 4 months ago

It looks like you ran the tool from within the tool's own source code. Since the tool is written in typescript that's likely why you got that language (weird that the file extension is .py though).

The tool is designed to be run from within a folder that has your other code (or an empty one I guess). When I run it inside a folder with python or ruby files it generally creates the right language for me.

LucasOscarSimon commented 4 months ago

It looks like you ran the tool from within the tool's own source code. Since the tool is written in typescript that's likely why you got that language (weird that the file extension is .py though).

The tool is designed to be run from within a folder that has your other code (or an empty one I guess). When I run it inside a folder with python or ruby files it generally creates the right language for me.

You're correct, I mistaken on that because I was trying to use it through powershell and since it didn't work I downloaded the souce code, then I followed the same approach I used with powershell but in the Linux that was inside Docker. My bad.

So... to start clean I deleted the source code folder inside the docker container and created a new one, I installed micro-agent through npm and now when I execute it it's asking me if I want to setup a new nodejs project, but I wanted to make something in python not in node. micro-agent2

tpaulshippy commented 4 months ago

Ah yes. The tool does not actually work in a blank folder. Sorry I forgot that.

The folder has to have one of these three files in it --

The tool also requires a test framework of some kind because the tool generates a test, generates an implementation, and then runs the test to see if the implementation passes the test.

tpaulshippy commented 4 months ago

See https://github.com/BuilderIO/micro-agent/issues/24

LucasOscarSimon commented 4 months ago

Ah yes. The tool does not actually work in a blank folder. Sorry I forgot that.

The folder has to have one of these three files in it --

  • package.json (node)
  • requirements.txt (python)
  • Gemfile (ruby)

The tool also requires a test framework of some kind because the tool generates a test, generates an implementation, and then runs the test to see if the implementation passes the test.

Thank you very much for your answer @tpaulshippy :-)

It took me a lot of tests to configure the environment the right way but now it's working as expected!

micro-agent-exchange_rate_converter testing_exchange_rate_converter

Great project you've made guys! Thank you very much!

LucasOscarSimon commented 4 months ago

As you can see above it's running over WSL Ubuntu, and a VS Code extension to access to the WSL project folder. I needed to install some python extensions, setup the unit tests using VS Code, rename the unit test file to follow python conventions, that allows the pytest framework to run the unit tests in the terminal and therefore allows micro-agent to run the python unit tests.

As I said, it took me a while but it worked :-)

steve8708 commented 4 months ago

ah, we could definitely make the DX better here to make this more clear, open to PRs to improve it!

yjgoh28 commented 4 months ago

I have changed to mac OS and it works now.

danividalg commented 4 months ago

I have Windows 10 and it does not work for me Any Solution ?

LucasOscarSimon commented 4 months ago

I have Windows 10 and it does not work for me Any Solution ?

Yeap, it worked with docker over wsl and it worked with wsl. Anyway I recently switched back to Linux.

danividalg commented 4 months ago

Any way to make it work without WSL ? (just with Windows cmd or powershell)