Tina Development — Common errors & solves

Wanted to start a thread where we can share some common errors we see working with Tina and amass some troubleshooting tips for how we solve them.

Common Errors

Another goodie :

Error: useCMS could not find an instance of CMS
▶ 19 stack frames were collapsed.
(anonymous function)
  64 | const preferDefault = m => (m && m.default) || m
  65 | let Root = preferDefault(require(`./root`))
  66 | domReady(() => {
> 67 |   renderer(<Root />, rootElement, () => {
  68 |     apiRunner(`onInitialClientRender`)
  69 |   })
  70 | })

These are the two most common issues I see working with Tina. I think the understanding was that the error is caused by peer dependency issues, or packages referencing multiple versions of react-tinacms…I’ll let @ncphi elaborate on the potential causes.

My solves :bomb:

Going ‘nucelar’ tends to work well with these issues.

Working on an external projects:

  • Make sure all Tina packages are at the latest in package.json. If you have a ^ situation and think you’re on ‘latest’, still manually type out the latest version number.
  • Delete node_modules directory
  • Delete yarn.lock
  • I also will delete any caches
  • Then npm install again
  • Repeat until it goes away :call_me_hand:

Working within the Tina codebase:

  • @spbyrne sent me these commands when I was having trouble one day and it made me smile :sweat_smile: but it is a pretty sure fire way to solve these types of issues when working in the Tina codebase: npm run nuke && npm install && npm run bs && npm run build

These are my go-to solves! Anyone else have good working solutions or common problems they run into?