Create-slice behaves differently since prismic-cli 4.2

Since I upgraded to the prismic-cli v4.2 the sm --create-slice behaves differently in the sense:

  1. it throws a conflict with slices\index.js and asks if it should overwrite it. I usually confirm that it can be overwritten, but i get this question every single time. Any idea how to fix this?

  2. It creates the index.stories.js and mocks.json into the .slicemachine\assets... folder instead in the slices... folder. This causes storybook to not recognize the slice. I can probably easily change this by telling storybook where to search, but I would like to get some advicehow to do it the right way.


Hello Peter, thanks for reaching out!

--create-slice is a legacy command that is no longer available to create new Slices. Now you should use the Slice Builder UI that helps you create your Slices visually:

We've mentioned this in other threads. Here's some useful advice:

Thanks, i updated now slice-machine-ui and when i run prismic sm --develop I get an error that Slicemachine requires node version >=15. To be able to test the website with the same node version as on production, I'm limitted to v12 and v14 though (production is on vercel). Do you have any tips for this issue?

That is strange. It should be working with at least version 12.16.1 of node. Can you please send us a screenshot of the error and your package.json file so we can reproduce your use case on our end?

I upgraded to 16 for testing purpose and it started fine.
In package.json I have for slicemachine this under devDependencies:
"slice-machine-ui": "^0.1.0"

I got another problem as well with the new version - it suddenly doesn't except special characters in field API ID's despite that the standard API fields have all underscores, such as first_publication_date. Why this inconsistency and do i really need to change all fields now?

Thank you for the details. Which special characters are you trying to add to the field's API IDs?

I'll scale the version error to the relevant team. We'll come back to you with answers as soon as possible.

underscores - to have it consistent with the standard fields.

I see. I'll share this with the product team, and we'll add it as a feature request.

About the errors with node 12. The dev team is going to release a brand new version of the Slice Machine workflow. This will involve installing this in your project:

npx @slicemachine/init

This will allow you to start the Slice Builder with one command:

npm run slicemachine

Next week we'll also release a fix that will enable this command to support node 12!
So for the moment, if you want to test this beta version of @slicemachine/init, you'll need to use node 15.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.