Configure a Project Automatically
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:
To check to see if you have npm installed, use this command:
If you're missing either one, you can follow these guides for installation:
To check if you have npx installed, use this command:
If you don't have it installed, run:
npm i -g npx
yarn global add npx
Install or update the Prismic CLI
Check if you have the latest version of the CLI installed globally with:
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 i -g prismic-cli
yarn global add prismic-cli
Log in to Prismic
If you don't yet have a Prismic account, run this command to sign up:
Otherwise, if you already have an account, run this command to sign in:
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:
npx create-nuxt-app example-project-name
yarn create-nuxt-app example-project-name
Then open the project folder:
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:
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.
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.
Was this article helpful?
Can't find what you're looking for? Get in touch with us on our Community Forum.