Error after updating Slicemachine [Yarn]

I am using the following repo which came from a YouTube tutorial and is using the Next.js starter kit. https://github.com/skyward-digital/next-starter-prismic I had everything working correctly according to the tutorial and was able to create slices and push to Prismic and my local Next.js site worked great. So Slicemachine started barking at me to update. I got a constant nag screen to update Slicemachine with a copy and paste command of "yarn upgrade -D slice-machine-ui" which I did. But after doing so, when I try to run "yarn run slicemachine", I immediately get an error:

yarn run v1.22.17
$ start-slicemachine --port 9999
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at Object.join (node:path:1172:7)
    at JsonPackagePath (/Users/ehaemmerle/Sites/sandbox/next-starter-prismic/node_modules/slice-machine-ui/node_modules/@slicemachine/core/build/src/filesystem/paths.js:73:49)
    at retrieveJsonPackage (/Users/ehaemmerle/Sites/sandbox/next-starter-prismic/node_modules/slice-machine-ui/node_modules/@slicemachine/core/build/src/filesystem/pkg.js:7:49)
    at Object.defineFramework (/Users/ehaemmerle/Sites/sandbox/next-starter-prismic/node_modules/slice-machine-ui/node_modules/@slicemachine/core/build/src/utils/framework.js:35:54)
    at run (/Users/ehaemmerle/Sites/sandbox/next-starter-prismic/node_modules/slice-machine-ui/start/index.js:162:37)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ERR_INVALID_ARG_TYPE'

I tried deleting my node_modules directory and doing "yarn install" but that didn't work. I still get the error when trying to run slicemachine. I'm not sure what is causing this. The YouTube tutorial I followed is here: https://www.youtube.com/watch?v=-c0okRzJJXQ

Hi Erich,

Welcome to the community!

I'm sorry to see you're having this issue. We saw an issue like that with the yarn upgrade command, where yarn is updating the slice-machine-ui package but not the dependencies.

You can solve his issue by using yarn add slice-machine-ui@latest.

Thanks.

1 Like

Awesome thanks. That worked!

1 Like

I just updated to 0.4.2 and got the error below when running yarn slicemachine. This was also fixed by running yarn add slice-machine-ui@latest. Just including this knowledge here!

/node_modules/slice-machine-ui/build/lib/env/resolveAliases.js:11
    const pkg = core_1.FileSystem.retrieveJsonPackage(cwd).content;
                                  ^

TypeError: Cannot read properties of undefined (reading 'retrieveJsonPackage')
1 Like