Configure a Project AutomaticallyBeta

On this page, you'll learn how to use the Prismic CLI to do all of the setup for your Slice Machine project.


Install Node, npm, and npx

Nuxt runs on Node.js. To check if you have Node installed, use this command:

Copy
node -v

To check to see if you have npm installed, use this command:

Copy
npm -v

If you're missing either one, you can follow these guides for installation:

To check if you have npx installed, use this command:

Copy
npx -v

If you don't have it installed, run:

  • npm
  • Yarn
Copy
npm i -g npx
Copy
yarn global add npx

Install or update the Prismic CLI

Check if you have the latest version of the CLI installed globally with:

Copy
prismic --version

If you have the Prismic CLI installed, this will tell you whether your version is up-to-date.

If you have the Prismic CLI installed and your version is not up-to-date, follow the instructions to update your CLI.

If your version is not up to-date-, or if you get the message prismic: command not found, then install/update the Prismic CLI with this command:

  • npm
  • Yarn
Copy
npm i -g prismic-cli
Copy
yarn global add prismic-cli

Log in to Prismic

If you don't yet have a Prismic account, run this command to sign up:

Copy
prismic signup

Otherwise, if you already have an account, run this command to sign in:

Copy
prismic login

Open or create a Nuxt project

If you already have a Nuxt project started, navigate to the root folder in your terminal, then skip to the next step.

If you don't already have a Nuxt project started, create one with this command:

  • npm
  • Yarn
Copy
npx create-nuxt-app example-project-name
Copy
yarn create-nuxt-app example-project-name

Then open the project folder:

Copy
cd example-project-name

Set up Prismic and Slice Machine

The setup command will add all of the necessary dependencies for your project, create a Prismic repo, and add your repo URL to your project config. Run this command:

Copy
prismic sm --setup

The installer will guide you through the next steps.

Behind the scenes, this command:

  • adds Prismic's default Slice library, with some dependencies;
  • adds a Slice Machine config file (sm.json);
  • creates a Prismic repository with a 'Page' Custom Type;
  • and, installs the dependencies for working with Prismic and Nuxt.


Troubleshooting

If you have any issues:

  • Check that your Prismic CLI is up to date, then try again
  • Log out and log in, then try again
  • Delete your project files, uninstall the Prismic CLI, reinstall the CLI, log in, and try again

If that doesn't work, visit the Prismic Community Forum to see if any other users report similar issues, or post your own question.


Related Articles