Logo Astro Collaborative Starter
You
Users online

'Cannot find module' fix

Fix for "Cannot find module '...' or its corresponding type declarations. ts(2307)"

This is currently occurring because of an Astro bug meaning imports must be imported in a different way.

How to fix

Place this in your tsconfig.json file:

"compilerOptions": {
  "baseUrl": "./",
  "paths": {
    "astro-collab/LiveblocksRoom.astro": ["node_modules/astro-collab/lib/LiveblocksRoom.astro"],
    "astro-collab/LiveAvatars.astro": ["node_modules/astro-collab/lib/LiveAvatars.astro"],
    "astro-collab/LiveCursors.astro": ["node_modules/astro-collab/lib/LiveCursors.astro"],
    "astro-collab/LiveDrawing.astro": ["node_modules/astro-collab/lib/LiveDrawing.astro"],
    "astro-collab/LiveForm.astro": ["node_modules/astro-collab/lib/LiveForm.astro"],
    "astro-collab/LiveUserForm.astro": ["node_modules/astro-collab/lib/LiveUserForm.astro"],
    "astro-collab/LiveUsers.astro": ["node_modules/astro-collab/lib/LiveUsers.astro"],
    "astro-collab/RandomUserInfo.astro": ["node_modules/astro-collab/lib/RandomUserInfo.astro"]
  }
}

Important note

All multiplayer components must be wrapped in a single LiveblocksRoom component, check the quick start guide for more info.

Components

Multiplayer cursors
<LiveCursors>
Live avatar stack
<LiveAvatars>
Live user list
<LiveUsers>
Collaborative form
<LiveForm>
Edit user form
<LiveUserForm>
Live drawing
<LiveDrawing>
Random user info
<RandomUserInfo>
Liveblocks room
<LiveblocksRoom>
@ctnicholasdev