Skip to content

Using GPT Pilot with frontend frameworks

Senko Rašić edited this page Jan 28, 2024 · 1 revision

Currently, GPT Pilot works best with vanilla JavaScript on the frontend.

While you can still use a framework such as React, Vue or Angular, you may run into problems. This page is a work-in-progress to list the problems and workarounds.

React and Next.js

You'll need to manually run create-react-app (or create-next-app) and tell it to create the project in the project root folder (not to create a sub-directory).

  1. When GPT Pilot asks you if it can run npx create-react-app, don't press/click anything yet;
  2. Open the terminal and navigate to the root directory of your project (for example if your project is called hello-world, this would be /path/to/your/gpt-pilot/workspace/hello-world)
  3. Move tests, .gpt-pilot and any other files or subdirectores (if they exist) to a temporary directory, such as tmp:
    ls -a
    # Any files/folders that appear in the list should be temporarily moved elsewhere, for example to /tmp
    mv tests /tmp
    mv .gpt-pilot /tmp
    
  4. Create the React/Next project (note the dot . here is important!):
    npx-create-react-app . # or npx create-next-app .
    
  5. When it is finished, go back to GPT Pilot and say/click "no" (so it doesn't try to execute the create command).