✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Error installing "stablo" template, resolved with code change.

4 replies
Last updated: Oct 17, 2022
Hello people,I’m new here and I hope I could get some help.
I’m trying to install the template “stablo” but I keep on running into a problem in components/postlist.js (67:27) @ PostList:



<div className="flex items-center gap-3">

66 |             <div className="relative flex-shrink-0 w-5 h-5">

> 67 |               {post.author.image && (

|                           ^

68 |                 <Image

69 |                   src={AuthorimageProps.src}

70 |                   blurDataURL={AuthorimageProps.blurDataURL}


Any idea?
Any suggestion is welcome.
Thanks!
Oct 17, 2022, 1:32 PM
youre showing the code point the error is coming from, but not the error message. What is the error message?
Oct 17, 2022, 1:33 PM
Sorry:
error - TypeError: Cannot read properties of null (reading 'image')
    at PostList (webpack-internal:///./components/postlist.js:140:59)
    at renderWithHooks (/Users/marioparra/websites/stablo-1.0.0/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5658:16)
    at renderIndeterminateComponent (/Users/marioparra/websites/stablo-1.0.0/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5731:15)
    at renderElement (/Users/marioparra/websites/stablo-1.0.0/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7)
    at renderNodeDestructiveImpl (/Users/marioparra/websites/stablo-1.0.0/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11)
    at renderNodeDestructive (/Users/marioparra/websites/stablo-1.0.0/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14)
    at renderNode (/Users/marioparra/websites/stablo-1.0.0/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6259:12)
    at renderChildrenArray (/Users/marioparra/websites/stablo-1.0.0/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6211:7)
    at renderNodeDestructiveImpl (/Users/marioparra/websites/stablo-1.0.0/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6141:7)
    at renderNodeDestructive (/Users/marioparra/websites/stablo-1.0.0/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) {
Oct 17, 2022, 1:36 PM
apparently your post doesnt have an author
You could change the code to
post?.author?.image
, though it might also be a problem with your content/CMS if yours shouldalways have an author
Oct 17, 2022, 1:38 PM
Woooow, thanks a lot. That solved the problem for me! 🙂
Oct 17, 2022, 1:43 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?