WASP CLI PROCESS ERROR Error: spawn wasp-cli ENOENT
Trying to run wasp-ai locally. When I generate a new app using any of the templates, I get the error above. Not sure where else to look for what's breaking. Any pointers are appreciated.
12 Replies
[Server!] WASP CLI PROCESS ERROR Error: spawn wasp-cli ENOENT
[Server!] at ChildProcess._handle.onexit (node:internal/child_process:283:19)
[Server!] at onErrorNT (node:internal/child_process:476:16)
[Server!] at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
[Server!] errno: -2,
[Server!] code: 'ENOENT',
[Server!] syscall: 'spawn wasp-cli',
Aha @martinsos will provide specific info π
Hey @bme_vegas , happy to help!
So from what I see, you are trying to run the actual GPT Web App Generator locally -> we haven't made it yet super friendly to run locally, so that is why it is a bit confusing on how to run it.
One easy way to run Wasp AI locally is to run it via CLI, not via app, as per instructions in the very last entry of the GPT Web App Generator's FAQ (on its webpage) -> so that is certainly the easiest, and it will generate the app directly on your disk. But, you won't have a nice UI that app brings.
As for running the app, which is what you tried, there are a couple of things it requires:
1. Local installation of
wasp
that is AI capable. It looks for wasp-cli
actually, because that is how we alias our wasp
CLI during development. You can get that installed by going into waspc
dir in the repo and following instructions for installation (running cabal install
) but that will require that you have Haskell installed and will take a long time.
Another option is that you install AI capable version of wasp as per instructions provided in the FAQ that I mentioned above, and once you have that, hunt down the line in Web App Generator app that references wasp-cli
and change that to wasp
, so it will use that wasp
binary.
2. You will also possibly need to set some ENV vars in .env.server, for example JWT_SECRET. But maybe you won't hit those, I am not sure.I have a penchant for rolling wheels up steep hills, so...
Thanks for the pointers, I haven't worked much with wasp.
I'm interested in seeing wasp-ai run locally and updating it to talk to Azure's OpenAI service to see how it compares.
Where can I find this?
Another option is that you install AI capable version of wasp as per instructions provided in the FAQ@martinsos
curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v 0.11.1-wasp-ai-11
I assume gets me a wasp
that supports "new-ai" but doesn't seem to πWohooo @bme_vegas, you just became a Waspeteer level 1!
I assume gets me a wasp that supports "new-ai" but doesn't seem to πhey @bme_vegas, let's get to the bottom of this! What happens when you try to run it?
Yes it should! But maybe it is not obvious that it does -> @Filip asked a good question to test if it does support AI capabilities, and if that works, then you need to adjust the wasp-ai app itself to use this binary as I described above.
Apologies for the delay, looks like I just need to grab an API key
β --- [Error] Missing OPENAI_API_KEY environment variable: -----------------------
Wasp AI uses ChatGPT to generate your project, and therefore requires you to provide it with an OpenAI API key.
You can obtain this key via your OpenAI account's user settings (https://platform.openai.com/account/api-keys).
Then, add
export OPENAI_API_KEY=<yourkeyhere>
to .bash_profile or .profile, restart your shell, and you should be good to go.
That's right! You only need your key for running Wasp AI locally though. The web app uses our key π
I upgraded my subscription and will try it again in just a bit, I'm expecting it to work.
I had tried newai using the parameters from the errored output to no avail.
woot!
====== RESPONSE ======
ChatResponse
{ id = "chatcmpl-7tMd0jFf18jwUPx58YEkHZjOS9jLp"
, object = "chat.completion"
, created = 1693429378
, model = "gpt-4-0613"
Looks like it's off to the races.
So to use this wasp version with the web app - should I just do this:
else {
waspCliProcess = spawn("wasp", waspCliProcessArgs, {
env: { ...process.env, waspc_datadir: undefined },
});
or is this good enough to?
if (process.env.NODE_ENV !== "production") {
waspCliProcess = spawn("wasp", waspCliProcessArgs);
}
I think the best option will be going with the latter.
For the cleanest result, replace
with
I haven't tried this, but I think it should be ok!
An nice job on managing to run
wasp
directly, that output is looking good indeed, those are calls to GPT! CLI has all the functionalities that web app has btw -> web app is just UI for it. Ok, except for storing the generated project in the database and sharing it around. But regarding generating the code, that is CLI that is doing the work.