Skip to content

Fresh app has broken types #1791

Open
Open
@steadicat

Description

Following the instructions to create a new app using npx create-mastra@latest, the created app has type errors. It is not immediately obvious what is wrong and how to fix it. Not a great first impression.

Tested with node 18, node 20, and node 22.

Full repro below.

~/GitHub/steadicat ‣ npx create-mastra@latest                                      
┌  Mastra Create
│
◇  What do you want to name your project?
│  mastra-test
│
◇  Project created
│
◇  NPM dependencies installed
│
◇  mastra installed
│
◇  @mastra/core installed
│
◇  .gitignore added
│
└  Project created successfully


┌  Mastra Init
│
◇  Where should we create the Mastra files? (default: src/)
│  src/
│
◇  Choose components to install:
│  Agents
│
◇  Add tools?
│  Yes
│
◇  Select default provider:
│  Groq
│
◇  Enter your groq API key?
│  Skip for now
│
◇  Add example
│  Yes
│
◇  
│
◇   ───────────────────────────────────────────────────────╮
│                                                          │
│                                                          │
│        Mastra initialized successfully!                  │
│                                                          │
│        Add your GROQ_API_KEY as an environment variable  │
│        in your .env.development file                     │
│                                                          │
│                                                          │
├──────────────────────────────────────────────────────────╯
│
└  
   To start your project:

    cd mastra-test
    npm run dev
  


~/GitHub/steadicat ‣ cd mastra-test

~/GitHub/steadicat/mastra-test ‣ tsc 
zsh: correct tsc to gsc [nyae]? n
src/mastra/agents/index.ts:1:23 - error TS2307: Cannot find module '@mastra/core/agent' or its corresponding type declarations.
  There are types at '/Users/stefano/GitHub/steadicat/mastra-test/node_modules/@mastra/core/dist/agent/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

1 import { Agent } from '@mastra/core/agent';
                        ~~~~~~~~~~~~~~~~~~~~

src/mastra/index.ts:2:24 - error TS2307: Cannot find module '@mastra/core/mastra' or its corresponding type declarations.
  There are types at '/Users/stefano/GitHub/steadicat/mastra-test/node_modules/@mastra/core/dist/mastra/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

2 import { Mastra } from '@mastra/core/mastra';
                         ~~~~~~~~~~~~~~~~~~~~~

src/mastra/index.ts:3:30 - error TS2307: Cannot find module '@mastra/core/logger' or its corresponding type declarations.
  There are types at '/Users/stefano/GitHub/steadicat/mastra-test/node_modules/@mastra/core/dist/logger/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

3 import { createLogger } from '@mastra/core/logger';
                               ~~~~~~~~~~~~~~~~~~~~~

src/mastra/tools/index.ts:1:28 - error TS2307: Cannot find module '@mastra/core/tools' or its corresponding type declarations.
  There are types at '/Users/stefano/GitHub/steadicat/mastra-test/node_modules/@mastra/core/dist/tools/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

1 import { createTool } from '@mastra/core/tools';
                             ~~~~~~~~~~~~~~~~~~~~

src/mastra/tools/index.ts:31:21 - error TS7031: Binding element 'context' implicitly has an 'any' type.

31   execute: async ({ context }) => {
                       ~~~~~~~


Found 5 errors in 3 files.

Errors  Files
     1  src/mastra/agents/index.ts:1
     2  src/mastra/index.ts:2
     2  src/mastra/tools/index.ts:1

~/GitHub/steadicat/mastra-test ‣ node --version                                                                                                              
v22.13.1

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions