Unable to setup prismic with yarn pnp mode

Describe your question/issue in detail

I am trying to go through the documentation of installation of prismic with next.js. I tried running the npx @slicemachine/init@latest setup command. I expected it to work properly but it throws the following error :

Installed core dependencies with yarn@berry
❯ Created Slice Machine configuration
:heavy_multiplication_x: Loading adapter...
→ Could not resolve plugin @slicemachine/adapter-next. Check that it has been installed.
Error: Could not resolve plugin @slicemachine/adapter-next. Check that it has been installed.

Impacted feature

The installation of the slice machine is impacted.

What steps have you taken to resolve this issue already?

I am using the new pnp mode of yarn. For this mode I am unable to install the dependencies. But if I run the yarn with the old mode of installing node_modules, then I am able to install the setup command just fine.
From this I can concur that as of now prismic is not supporting the pnp mode of yarn. Is my assumption correct?

Errors

Installed core dependencies with yarn@berry
❯ Created Slice Machine configuration
:heavy_multiplication_x: Loading adapter...
→ Could not resolve plugin @slicemachine/adapter-next. Check that it has been installed.
Error: Could not resolve plugin @slicemachine/adapter-next. Check that it has been installed.

Your Role

Developer

Hosting provider

getting this error in local setup so no hosting info required.

Package.json file

{
"name": "test-prismic",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "14.2.4",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@slicemachine/adapter-next": "^0.3.42",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.4",
"postcss": "^8",
"slice-machine-ui": "^2.2.1",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},
"packageManager": "yarn@4.3.1"
}

Steps to reproduce

  1. Create a next js repo making sure to use the pnp mode of yarn
  2. Run the npx @slicemachine/init@latest command and it will throw error.

Just checking if anyone looked into this?

Hey @hardik,

I'm sorry we couldn't get back to you earlier.
Indeed it looks like Slice Machine doesn't work with PnP as of yet. I just opened a PR which should fix that: fix: Yarn PnP support by lihbr · Pull Request #1395 · prismicio/slice-machine · GitHub

Once shipped, Slice Machine should work with Yarn PnP :slight_smile:

We'll keep you posted!

Thanks