Skip to content

Adding npm packages

Your project is real code, and real code uses libraries. Ask for one by name and the AI adds the npm package to the project, installs it, and can use it straight away. It’s also how the AI changes a version that broke the preview, or takes a package out.

There’s no terminal and you never edit package.json yourself — the AI does it through this step, which is the only way dependencies change.

Name the library, or describe what you need and let the AI pick one. For example:

  • “Install framer-motion and animate the hero”
  • “Add date-fns for the event dates”
  • “Use version 3 of zod instead”
  • “Remove the chart library, we don’t use it any more”

The AI also does it on its own when the code it writes needs a package the project doesn’t have yet, or when the preview breaks because of a package.

  • Every name and version is checked against the npm registry. A package that doesn’t exist is refused, never written — a wrong name would break every later install.
  • Required companion packages come along with the one you asked for.
  • Adding installs into the preview that’s already running.
  • Changing or removing a version restarts the live preview with a clean install, which takes 1–3 minutes.
  • The change to package.json shows in the turn’s changes like any other file, so you can revert it.
AppHow packages are installed
WebsiteInto the project and the live preview, as above.
Web appOn the app’s own server; they stay installed across restarts and go into the published build.
Mobile appPlain JavaScript libraries, at a version that fits the app’s Expo build. Libraries with their own native code beyond Expo don’t run in Expo Go.
Desktop appInto the app window running on your computer, which reloads by itself a few seconds later. If the desktop app isn’t connected, the package installs the next time you open the window.
  • Some libraries are fixed by the preview. React, Vite, Tailwind and the starter’s own libraries always use the preview’s copy. A version outside the major version the preview runs is refused, and the AI tells you why.
  • On a desktop app, only libraries for the app’s screens help. A library meant for the part of the app that talks to the operating system (tray icons, global hotkeys, launch at login) can’t run there, and the AI says so instead of installing it.
  • If the preview breaks after an install, ask the AI to fix it — changing a version or removing a package is part of the same tool. See Fixing errors.