This is the first time me trying Prismic and I'm looking at trying it out for a future project. Following the guide when creating a new Next.JS project
npx create-next-app dan-hayes
cd dan-hayes
Then
npx @slicemachine/init --repository dan-hayes
npm run slicemachine
Is giving me the error:
C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\cliLogs.js:8
const ora_1 = __importDefault(require("ora"));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\ora\index.js from C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\cliLogs.js not supported.
Instead change the require of index.js in C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\cliLogs.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\cliLogs.js:8:31)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\index.js:34:14)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\filesystem\manifest.js:4:17)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\filesystem\index.js:13:14)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\index.js:26:35)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\slice-machine-ui\build\scripts\start\index.js:7:16)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\slice-machine-ui\bin\start.js:3:1) {
code: 'ERR_REQUIRE_ESM'
}
It seems that in some places in your code you are using es 6 import where the SM modules use require, can you try to switch in require for your modules
I feel like people are not understanding what I'm talking about here.
This is a blank new project. An empty folder.
I create a "Next.JS Project" on Prismic.
It gives a guide on the right hand side on how to start a project.
I run the required commands:
npx create-next-app dan-hayes
cd dan-hayes
and
npx @slicemachine/init --repository dan-hayes
npm run slicemachine
It returns the error
C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\cliLogs.js:8
const ora_1 = __importDefault(require("ora"));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\ora\index.js from C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\cliLogs.js not supported.
Instead change the require of index.js in C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\cliLogs.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\cliLogs.js:8:31)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\utils\index.js:34:14)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\filesystem\manifest.js:4:17)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\src\filesystem\index.js:13:14)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\@slicemachine\core\build\index.js:26:35)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\slice-machine-ui\build\scripts\start\index.js:7:16)
at Object.<anonymous> (C:\Users\toms\Documents\Projects\GitHub\dan-hayes\node_modules\slice-machine-ui\bin\start.js:3:1) {
code: 'ERR_REQUIRE_ESM'
}
If you have a look at where the error is coming from it's @slicemachine\core\build\src\utils\cliLogs.js:8 const ora_1 = __importDefault(require("ora"));.
This is an error coming from Slice Machine. This isn't some place in my code, because there is no "my code". I haven't been able to get to that point.