kit-docs: Unexpected token < in JSON at position 0 on each route

I copied the docs route folder from this repo as a starting point but I keep getting this error, the only thing I changed in the folder is I removed the images (logo, and social card) and all the references to it, I also renamed layout to layout.reset because I have a root layout

I have a [dir].sidebar.json.js with the following code

import { createSidebarRequestHandler } from '@svelteness/kit-docs/node';

export const get = createSidebarRequestHandler();

and [slug].meta.json.js

import { createMetaRequestHandler } from '@svelteness/kit-docs/node';

export const get = createMetaRequestHandler();

this is my svelte config

import preprocess from 'svelte-preprocess';
import adapter from '@sveltejs/adapter-auto';
import {kitDocsPlugin} from '@svelteness/kit-docs/node'
import Icons from 'unplugin-icons/vite'

/** @type {import('@sveltejs/kit').Config} */
const config = {
	extensions: ['.svelte', '.md'],
	kit: {
		adapter: adapter(),
		vite:{
			optimizeDeps: {
				exclude: ['@urql/svelte', '@urql/core'],
			  },

			  plugins: [
				  Icons({compiler: 'svelte'}),
				  kitDocsPlugin({
					  shiki: {
						  theme: 'material-ocean'
					  },
				  }),
			  ],
			
		}
	},

	preprocess: [
		preprocess({
			postcss: true
		})
	]
};

export default config;

I always get the same error,

500
Unexpected token < in JSON at position 0
SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Proxy.<anonymous> (file:///Users/isaac/Desktop/projects/saffron/redo/frontend/.svelte-kit/runtime/server/index.js:1797:21)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async eval (/node_modules/@svelteness/kit-docs/client/loaders/index.js:22:22)
    at async load_node (file:///Users/isaac/Desktop/projects/saffron/redo/frontend/.svelte-kit/runtime/server/index.js:1826:12)
    at async respond$1 (file:///Users/isaac/Desktop/projects/saffron/redo/frontend/.svelte-kit/runtime/server/index.js:2177:15)
    at async render_page (file:///Users/isaac/Desktop/projects/saffron/redo/frontend/.svelte-kit/runtime/server/index.js:2378:19)
    at async resolve (file:///Users/isaac/Desktop/projects/saffron/redo/frontend/.svelte-kit/runtime/server/index.js:2610:11)
    at async respond (file:///Users/isaac/Desktop/projects/saffron/redo/frontend/.svelte-kit/runtime/server/index.js:2543:20)
    at async file:///Users/isaac/Desktop/projects/saffron/redo/frontend/node_modules/@sveltejs/kit/dist/chunks/index.js:244:24

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

Since 0.7.2 it works fine. Thank you a lot 😃

I got the same kind of error if I am not mistaken:

https://github.com/Myrmod/svelte-babylon/tree/kit-docs

git clone git@github.com:Myrmod/svelte-babylon.git && cd svelte-babylon
git checkout kit-docs
npm ci
npm run dev