Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Can't run sanity start #5

Open
kongweiying2 opened this issue Apr 24, 2021 · 5 comments
Open

Can't run sanity start #5

kongweiying2 opened this issue Apr 24, 2021 · 5 comments

Comments

@kongweiying2
Copy link

kongweiying2 commented Apr 24, 2021

I'm attempting to follow the instructions at the end of this starter:

https://www.sanity.io/create?taskId=SyNOeWRyGZxOTULAdkJU&template=sanity-io%2Fsanity-template-nextjs-blog-comments

It says to run:

sanity start

When I attempt to run the Sanity Studio locally, I get this error:

Error: Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 20 characters

at Object.e.dataset (/usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js:538:476)
    at e.initConfig (/usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js:4266:1246)
    at g.config (/usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js:4008:1254)
    at new g (/usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js:4008:772)
    at g (/usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js:4008:755)
    at Object.apiClient (/usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js:1632:911)
    at ~/programming/projects/next-js-blog-with-comments/studio/node_modules/@sanity/core/lib/actions/start/startAction.js:160:41
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (~/programming/projects/next-js-blog-with-comments/studio/node_modules/@sanity/core/lib/actions/start/startAction.js:42:103)
    at _next (~/programming/projects/next-js-blog-with-comments/studio/node_modules/@sanity/core/lib/actions/start/startAction.js:44:194)
@neilbradley
Copy link

Also seeing this error. I think it's these lines in the sanity.json causing the issue?

"api": { "projectId": "PLACEHOLDER_ENV_VARIABLES_WILL_HANDLE_FOR_US", "dataset": "PLACEHOLDER_ENV_VARIABLES_WILL_HANDLE_FOR_US" },

@neilbradley
Copy link

@TheAussieStew I found the workaround, in the sanity.json file change the following from:

  "api": {
    "projectId": "PLACEHOLDER_ENV_VARIABLES_WILL_HANDLE_FOR_US",
    "dataset": "PLACEHOLDER_ENV_VARIABLES_WILL_HANDLE_FOR_US"
  },

to:

  "api": {
    "projectId": "placeholder",
    "dataset": "placeholder"
  },

@markplewis
Copy link

I encountered the same error when running npm run start:sanity from the project root. The above workaround fixed it for me.

@benjaminkonopka
Copy link

@neilbradley your the man 👯 thanks for helping

@clytwynec
Copy link

It looks like there is an omitted step in the readme. It seems you have to add an env.development file like the following under the studio directory before running sanity start.

# For Studio
SANITY_STUDIO_API_PROJECT_ID="yourProjectId"
SANITY_STUDIO_API_DATASET="your_dataset_name"

See more: https://www.sanity.io/docs/studio-environment-variables#f5e9e3158896

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants