Hello,
I'm trying to get started with Prismic and I'm already running into a problem. I am following the guide to setup a project with nextjs. Everything works smoothly until I attempt to run slicemachine. It appears there is a problem in the node_modules communication between "ora" and "@slicemachine". I have tried the suggested solution of changing the filename in question to index.cjs and removing the "type: module" in the package.json. Here is the CLI readout:
You're about to configure Slicemachine... Press ctrl + C to cancel
✔ Logged in as ********
✔ Next.js detected
? Connect a Prismic Repository or create a new one Create a new Repository
ℹ The name acts as a domain/endpoint for your content repo and should be completely unique.
? Name your Prismic repository https://********
✔ We created your new repository https://********
✔ The Prismic Visual Builder was installed successfully
✔ Project configured! Ready to start
■ Run npm run slicemachine to now launch your Local Builder
********@******** ******** % npm run slicemachine
> slicemachine
> start-slicemachine
node:internal/modules/cjs/loader:1125
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/********/********/nextjs/********/node_modules/ora/index.js
require() of ES modules is not supported.
require() of /Users/********/********/nextjs/********/node_modules/ora/index.js from /Users/********/********/nextjs/********/node_modules/@slicemachine/core/build/src/utils/cliLogs.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/********/********/nextjs/********/node_modules/ora/package.json.
at new NodeError (node:internal/errors:363:5)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1125:13)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (/Users/********/********/nextjs/********/node_modules/@slicemachine/core/build/src/utils/cliLogs.js:8:31)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32) {
code: 'ERR_REQUIRE_ESM'
}
Please help as I would really love to use Prismic on a project.
Welcome to the Prismic community, and thanks for reaching out to us.
To set up the Slice machine, you need at least Node.js 12.0 or later. Check this by running node -v in your terminal.
Can you also paste your package.json here? We don't need to install npm install ora@5.4.1. You might need to update npm version too. Try running npm install -g npm@latest.
I'm new to Prismic. I was wanting to try it to see if it was suitable for a future project.
I've created an account and clicked on "Next.js project" it then gives you a guide on the right hand side to get started. I have followed those instructions perfectly and it doesn't work. Everything will be the latest version.