Create new theme not working

Hello,

I'm trying to create a prismic theme with some custom types inside but I'm getting an error when running the command. This is what I have done so far:

  • created a public repo on github to hold the theme files
  • added a custom_types folder and added a json file for each custom type
  • added a prismic-configuration.json at the root of the repo
  • installed prismic cli: prismic-cli/4.2.0 linux-x64 node-v10.19.0
  • run the create theme command: prismic theme --theme-url https://github.com/mygithubid/prismic-theme --conf prismic-configuration.json

I'm getting the following error :
SyntaxError: Invalid or unexpected token

Also, I've read somewhere there is a possibility of using a zip file instead of a git repo and that would be fine for us but I didn't find documentation on how to do it this way.

Thanks for any help

Hey, @louis-marie.desurema welcome to the forum, and thanks for reaching out!
This is happening because the theme command only works with public GitHub repositories.

Your setup looks correct. As soon as you make the repo public, it should work just fine :ok_hand:

Hi Pau and thank you for the prompt reply!

The repo is already public, I created it especially to make the prismic theme work, however I'm getting this error. Any other idea ?

Maybe you need to double-check that you are using the correct URL of your GitHub repository. If I open this one: https://github.com/mygithubid/prismic-theme it shows me a 'Page not found'.

This happens when you don't have the proper permissions on GitHub to access it.

That's only because I have the habit of not posting account links on public forum; Now that I think about it, I'm not even sure why :sweat_smile:

The real link to the repo is this one. I can confirm that in the repo settings the access is set public

I tried to completely uninstall and reinstall npm from my computer and there is some progress, I am now able to login with prismic cli and the token error is gone !

however, I have a new error now when I run

prismic theme --theme-url prismic-theme.zip --conf prismic-configuration.json
or
prismic theme --theme-url https://github.com/marcodepolo/prismic-theme --conf prismic-configuration.json

node:events:368
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, scandir '/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/generator-prismic-angular2/lib/generators'
    at Object.readdirSync (node:fs:1390:3)
    at exports.readdir (/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/@mrmlnc/readdir-enhanced/lib/sync/fs.js:18:20)
    at Object.safeCall [as safe] (/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/@mrmlnc/readdir-enhanced/lib/call.js:24:8)
    at DirectoryReader.readNextDirectory (/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/@mrmlnc/readdir-enhanced/lib/directory-reader.js:78:10)
    at Readable.DirectoryReader.stream._read (/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/@mrmlnc/readdir-enhanced/lib/directory-reader.js:57:18)
    at Readable.read (node:internal/streams/readable:496:27)
    at readdirSync (/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/@mrmlnc/readdir-enhanced/lib/sync/index.js:27:21)
    at Function.readdirSyncStat (/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/@mrmlnc/readdir-enhanced/lib/index.js:34:10)
    at ReaderSync.dynamicApi (/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/yeoman-environment/node_modules/fast-glob/out/providers/reader-sync.js:64:24)
    at ReaderSync.api (/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/yeoman-environment/node_modules/fast-glob/out/providers/reader-sync.js:56:25)
Emitted 'error' event on Readable instance at:
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/home/linuxbrew/.linuxbrew/lib/node_modules/prismic-cli/node_modules/generator-prismic-angular2/lib/generators'
}

Node.js v17.0.1

Which version of the CLI and node do you have?
I just ran your command and it worked correctly.

prismic-cli/4.2.0 linux-x64 node-v17.0.1

I was also able to run the command successfully on someone else computer

Ok, I was able to reproduce the error. It seems like it won't work with the latest version of node. Can you try with the recommended one: 16.13.0?

Hello team. We close the threads after a week with no new activity. If this happens and you want to continue the conversation, you can easily flag it to reopen it and add a new comment.
Thanks.

Threads close after a period of inactivity. Flag this thread to re-open it and continue the conversation.