Your first error message: how to read it without panic
Read any message from TypeScript or Node with five questions: who wrote it, where, what is wrong, any guess, which characters. Find the line and column, skip the stack trace and files that are not yours, and fix a missing quote's three errors by fixing the first one.
Tooling
TypeScript
Your first error message: how to read it without panic. Read this lesson at .
Tested with TypeScript 7.x · Node.js LTS
At the end of the last lesson you broke index.ts three times on
purpose: a misspelled console, a deleted quote, a box that does
not exist. Each time the terminal answered with a block of text,
and one of them was long. Deleting a single quote gave you three
errors, on two different lines, ending in a sentence about "the
same file, starting at". The first instinct in front of text like
that is to feel you did something badly wrong, and to start
changing lines until it goes away.
Think of the proofreader from the last lesson. They hand your page
back with a note in the margin: line 3, the 24th character:
"verison" — did you mean "version"? That note is not a grade. It
is an address and one sentence, written so you can find the
mistake in seconds. An error message is the same note, printed in
a terminal. By the end of this lesson you can take any message
from TypeScript or Node and say, in under a minute, who wrote it,
which line it means, and what to change, and you know which of
three errors to fix first.
A message is a note, not a grade
An error message is what a tool prints when it cannot do what
you asked. TypeScript prints one when a line breaks its rules, and
Node prints one when a line cannot run. They are programs, and they
print the same message to everyone who makes that mistake, beginners
and people with twenty years of practice alike.
Every message is written to answer the same few questions, always
in the same places. Once you know where those places are, a long
message stops being a wall and becomes a form you fill in. You
already know the first question from the last lesson: who wrote
it?error TS (TS for TypeScript) and a count of errors mean
TypeScript, and nothing ran. Part of a run and a ReferenceError
mean Node. The rest of this
lesson is the other questions.
Five questions for TypeScript's message
Put the typo back into line 3 of index.ts, so it reads
console.log("TaskKit", verison);, save, and check the file.
tsc (short for TypeScript compiler) is the checker, and npx
starts the copy installed in taskkit, as in the last lesson:
As in the last lesson, the first line is one long line in your
terminal, broken in two here to fit the page. Its start,
index.ts:3:24, is the file, the line and the column: a
column is a position along the line, counted in characters from the
left edge, spaces and quotes included. Read the message with five
questions, in order. Press Next step to walk through them, or
let it play:
Who wrote it?
error TS2552: TypeScript. Nothing ran.
Where?
index.ts:3:24: file index.ts, line 3, column 24.
What is wrong?
Cannot find name 'verison'. No box has that name.
Any guess?
Did you mean 'version'? Check it against line 1.
Which characters?
The ~~~~~~~ under line 3 covers exactly verison.
Five questions answer any error message
All 5 steps shown.Step 1 of 5: Who wrote it?Step 2 of 5: Where?Step 3 of 5: What is wrong?Step 4 of 5: Any guess?Step 5 of 5: Which characters?
All 5 steps shown.
The where is those three things joined by colons. Column 24 of
line 3 is the v where verison starts:
You never count columns by hand. Click just before the v of
verison, and VS Code (Visual Studio Code, your editor) shows where
the cursor stands in the bar at the bottom of its window, Ln 3, Col 24 (line 3, column 24), and the ~~~ under the line in the message
marks the same characters.
The what is the sentence after the colon. Read it word by word
and take it literally: cannot find name means TypeScript looked
for a box called verison and there is none. TS2552 in front of
it is the error code, the number of this kind of mistake. Every
Cannot find name … Did you mean …? has the same code, in every
project in the world, which makes it the best thing to search for
when a sentence means nothing to you. The next lesson does exactly
that.
The guess, Did you mean 'version'?, is TypeScript noticing a name
that is spelled almost the same. It is right most of the time, but
it is still a guess: look at the line it suggests before you take
it. The indented part, 'version' is declared here., is extra
help, the line where that suggested name was made. It is not a
second error, and line 1 is not the line to change.
Notes about files that are not yours
Now misspell console instead, on the same line, and check again:
The five questions work as before: TypeScript, index.ts line 3
column 1, no box called consle, and a guess of console. Then a
path you have never seen, deep inside node_modules, at line 42905
of a file; it is one line in your terminal, broken in two here. That
is the extra help again: console was made not by you but in a file
that comes with TypeScript and lists what a web browser gives a
program, console among them. The end of the folder's name says
which system TypeScript was installed for: darwin-arm64 on a Mac
with an Apple chip (darwin-x64 on an Intel Mac), win32-x64 on
most Windows PCs, linux-x64 on most Linux PCs.
When a message mentions a file you did not write, it is pointing
you to where something was made, not to something you broke. The
mistake is always in your own file, on the line named in the first
line of the message. Fix consle on line 3, and the whole message
goes away.
Node's message: the answer is lower down
The last lesson read Node's message from the top; here each part
gets its name, and you see what is safe to skip. Put verison back
on line 3 and, this time, skip the check and run the file:
One of those lines is broken in two to fit the page. On newer
versions of Node the paths may start with file:/// and the list of
at lines may be one shorter; the last line shows your version.
The message is twice as long as TypeScript's and says less, but four
of the same questions answer it. Node makes no guess, and a new
question takes the fifth place: what can you skip?
Who wrote it?
Node.js v24.11.1 on the last line, and your output above it.
Where?
index.ts:3, at the end of the file's full path: line 3.
What is wrong?
ReferenceError: verison is not defined, below the line.
Which characters?
The ^ under the line marks where Node stopped.
What can you skip?
The at lines: where Node was inside its own code.
Node's message: the same questions, answered lower down
The at lines are a stack trace: a list of the places Node was
in when it stopped, your own line first. The first one is your own
file, index.ts:3:24, with the column TypeScript gave you. Every
other one points into Node's own code (node:…), which you never
wrote, so for a program of one file you can skip them all. The last
line, Node.js v24.11.1, is Node signing its name. It is not part
of the error, and it does not mean your version of Node is wrong.
For this mistake Node has no guess and no error code. The word
before the colon, ReferenceError, is the kind of error, and the
words after it are the sentence. That is why the check comes
first: TypeScript says the same thing more precisely, before any
line has run.
One mistake, several errors
The third way to break the banner was a deleted quote. Remove the
closing quote after TaskKit on line 3, so that line reads
console.log("TaskKit, version);, and check:
One character is missing, and there are three errors. The first says
the text that starts with "TaskKit never ends: a string
literal is text in quotes, and unterminated means its closing
quote is missing. The ~ sits at the end of the line, where
TypeScript gave up looking for the quote, not where the quote goes.
With that quote gone, TypeScript no longer knows where the text
stops and the code starts, so it reads on into line 4 looking for
the rest of line 3, and everything it finds there looks wrong as
well. Errors 2 and 3 are not new mistakes. They are the first one,
seen from further down the file.
So the order matters. Switch between the two ways of fixing it
below. Press Next step to walk through them, or let it play:
In the Fix line 4 version, the last check reports only line 3's
error. The comma and the bracket you added are still on line 4,
hidden, and they become errors of their own once line 3 is fixed.
Run both versions below. Run on these pages lists the same
errors in a shorter form: the line, the column and the sentence.
Bad — follows the second error and
puts a comma on line 4, so line 4 changes and line 3 is still
broken.
Good — fixes the first error, the
quote on line 3, and every error goes with it.
The bad version costs more than time. Every "fix" for an error
that was never a mistake is a change to a line that was right, and
when the real fix finally comes, those changes are still there,
now as mistakes of their own. Fix the first error, check again, and
only then look at what is left.
Predict before you run
You now know that one mistake can be reported more than once. Use
it: count the errors before TypeScript does.
Predict
How many errors does TypeScript report for this file?
The common mistake: the named line is fine
TypeScript reads the whole file and lists all three errors. Node
stops at the first thing it cannot understand and names one line,
and with a missing quote that line is not the one you broke.
Common mistake
Searching the named line for a mistake made above it
You deleted the quote on line 3, skipped the check, and ran
node index.ts. Not even the first banner line printed, and the
message names line 4:
Node shows the lines around the place, and ^^^^^^^ marks line 4,
the middle one. A SyntaxError is Node's word for text that is
not shaped like code: syntax is the rules for how code is
written, such as quotes in pairs and brackets that close. The part in
square brackets is Node's own code for this kind of error, the same
idea as TS2552. Newer versions of Node end the message with
got 'ident' (short for identifier, a name) instead of
got 'console': the same message.
You read line 4 again and again, and it is perfect: Node only got
lost there, because of what line 3 left open.
When the named line looks right, read the line above it, and the
one above that. Better still, ask the tool that lists every error
in order, and start with its first one:
Its first error names index.ts:3:32, the end of line 3, where
TypeScript gave up looking for the closing quote. The quote belongs
right after TaskKit.
Notice also what did not happen: no banner line printed. As the last
lesson showed, Node checks the shape of the whole file before it
runs line 1, so with a broken shape nothing runs, while a wrong name
like verison waits until Node reaches it.
Pass all three tasks to complete the lesson with practice. Reach the end without them and it counts as read only.
Exercises
These run in your browser. Two ask you to read a message, one to act
on one; try any of them in your own taskkit too.
Recap
Recap · 3 questions
Check yourself
Node names line 4, and line 4 looks perfect. What do you do?
Check yourself
A check reports three errors. Which do you fix first?
Check yourself
A message points into node_modules. Where is the mistake?
0 of 0 answered.
A cheat sheet to keep
Cheat sheet
Your first error message: how to read it
What things are
Word
What it means
Error message
A tool's note: where it stopped, and why
Line, column
Which line, and how many characters along it
Error code
TS2552: the number of a kind of TypeScript error
~~~ and ^
Marks under the exact place in the line
Declared here
Extra help: where a name was made, not an error
Stack trace
Node's at lines: the first is your line
ReferenceError
Node met a name with no box
SyntaxError
The text is not shaped like code; nothing ran
Five questions
Ask
TypeScript answers / Node answers
Who wrote it?
error TS / Node.js v24.11.1 at the end
Where?
index.ts:3:24 / …/index.ts:3
What is wrong?
The sentence on line 1 / the …Error: line
Any guess?
Did you mean …? / no guess here
Which characters?
~~~ under the line / ^ under the line
How to fix
Rule
What it means
First error first
Later errors often come from the first one
Check again
After each fix, before looking at the rest
Read upward
If the named line is fine, read the one above
Your file
Where to go next
You can now read any message from TypeScript or Node with five
questions, find the exact line and column it means, skip the parts
that are not about you, and fix several errors by fixing the first
one. A long message is no longer bad news, only a precise one.
Next is Where to find answers: docs, MDN, and AI assistants used
wisely. Sometimes the sentence names something you have never
heard of; the next lesson shows where to look it up, starting with
the error code, in MDN (Mozilla's web documentation) and elsewhere,
and how to ask an AI (artificial intelligence) assistant without
letting it think for you.
Before you move on, break index.ts once more, a new way: delete
the ) at the end of line 4. Before you check, write down which
line and which error you expect. Then run
npx tsc --noEmit index.ts, compare, and fix it until the check
prints nothing.
You
TypeScript
Node
You: npx tscnpxtscnpxtsc
TypeScript: 3 errors3errors3errors
You: comma on line 4commaonline4commaonline4
TypeScript: 2 errors2errors2errors
You: bracket on line 4bracketonline4bracketonline4
TypeScript: 1 error, line 31error,line31error,line3
Time
You check the banner. A quote is missing on line 3.
Found 3 errors in the same file, starting at line 3.
Line 4 sounds easy: ',' expected. You put a comma there.
Line 3 is still unclosed. Line 4 still wants a ).
The next one says ')' expected. You add one to line 4.
The first error is still there, and line 4 is now wrong too.
Three errors from one quote: fix the first, then check again
All 6 steps shown.Step 1 of 6: You: npx tscStep 2 of 6: TypeScript: 3 errorsStep 3 of 6: You: comma on line 4Step 4 of 6: TypeScript: 2 errorsStep 5 of 6: You: bracket on line 4Step 6 of 6: TypeScript: 1 error, line 3
All 6 steps shown.
You
TypeScript
Node
You: npx tscnpxtscnpxtsc
TypeScript: 3 errors3errors3errors
You: quote on line 3quoteonline3quoteonline3
TypeScript: no errorsnoerrorsnoerrors
Node: the bannerthebannerthebanner
Time
You check the banner. A quote is missing on line 3.
Found 3 errors in the same file, starting at line 3.
You start with the first error and close the quote on line 3.
All three are gone: one quote caused every one of them.
You run node index.ts, and all four banner lines print.
Three errors from one quote: fix the first, then check again
All 5 steps shown.Step 1 of 5: You: npx tscStep 2 of 5: TypeScript: 3 errorsStep 3 of 5: You: quote on line 3Step 4 of 5: TypeScript: no errorsStep 5 of 5: Node: the banner
All 5 steps shown.
The mistake is in your file, not in node_modules
Exercise · Predict the result
Which line to open
You check tasks.ts, and the message starts like this:
text
tasks.ts:5:23 - error TS2552: Cannot find name'totl'. Did you mean 'total'?
Which line of tasks.ts do you open to fix it?
Exercise · Read the code
Find the sentence in Node's message
You ran the same file with node tasks.ts, without checking it.
After three lines of output, Node printed this (the at lines cut
to two). Which line tells you what went wrong?
text
/Users/ana/projects/taskkit/tasks.ts:5console.log("Total:", totl); ^ReferenceError: totl is not defined at Object.<anonymous> (/Users/ana/projects/taskkit/tasks.ts:5:23) at Module._compile (node:internal/modules/cjs/loader:1761:14)Node.js v24.11.1
C:\Users\ana\projects\taskkit\tasks.ts:5console.log("Total:", totl); ^ReferenceError: totl is not defined at Object.<anonymous> (C:\Users\ana\projects\taskkit\tasks.ts:5:23) at Module._compile (node:internal/modules/cjs/loader:1761:14)Node.js v24.11.1
/home/ana/projects/taskkit/tasks.ts:5console.log("Total:", totl); ^ReferenceError: totl is not defined at Object.<anonymous> (/home/ana/projects/taskkit/tasks.ts:5:23) at Module._compile (node:internal/modules/cjs/loader:1761:14)Node.js v24.11.1
Outputtext
index.ts:3:24 - error TS2552: Cannot find name'verison'. Did you mean 'version'?3 console.log("TaskKit", verison); ~~~~~~~ index.ts:1:7 - 'version' is declared here. 1 const version = "0.1"; ~~~~~~~Found 1 error in index.ts:3
Outputtext
index.ts:3:32 - error TS1002: Unterminated string literal.3 console.log("TaskKit, version); ~index.ts:4:1 - error TS1005: ',' expected.4 console.log("Your tasks, in your terminal"); ~~~~~~~index.ts:4:44 - error TS1005: ')' expected.4 console.log("Your tasks, in your terminal"); ~Found 3 errors in the same file, starting at: index.ts:3
bash
npx tsc --noEmit index.ts
index.tsts
const version = "0.1";console.log("============================");console.log("TaskKit", verison);console.log("Your tasks, in your terminal");console.log("============================");
Line 3, column 24
index.tsts
const version = "0.1";console.log("============================");consle.log("TaskKit", version);console.log("Your tasks, in your terminal");console.log("============================");
bash
npx tsc --noEmit index.ts
bash
node index.ts
bash
npx tsc --noEmit index.ts
ts
const version = "0.1";console.log("============================");console.log("TaskKit, version);,console.log("Your tasks, in your terminal");console.log("============================");
ts
const version = "0.1";console.log("============================");console.log("TaskKit", version);console.log("Your tasks, in your terminal");console.log("============================");
index.ts:3:1 - error TS2552: Cannot find name'consle'. Did you mean 'console'?3 consle.log("TaskKit", version); ~~~~~~ node_modules/@typescript/typescript-darwin-arm64/lib/lib.dom.d.ts:42905:13 - 'console' is declared here. 42905 declare var console: Console; ~~~~~~~Found 1 error in index.ts:3
index.ts:3:1 - error TS2552: Cannot find name'consle'. Did you mean 'console'?3 consle.log("TaskKit", version); ~~~~~~ node_modules/@typescript/typescript-win32-x64/lib/lib.dom.d.ts:42905:13 - 'console' is declared here. 42905 declare var console: Console; ~~~~~~~Found 1 error in index.ts:3
index.ts:3:1 - error TS2552: Cannot find name'consle'. Did you mean 'console'?3 consle.log("TaskKit", version); ~~~~~~ node_modules/@typescript/typescript-linux-x64/lib/lib.dom.d.ts:42905:13 - 'console' is declared here. 42905 declare var console: Console; ~~~~~~~Found 1 error in index.ts:3
Outputtext
============================/Users/ana/projects/taskkit/index.ts:3console.log("TaskKit", verison); ^ReferenceError: verison is not defined at Object.<anonymous> (/Users/ana/projects/taskkit/index.ts:3:24) at Module._compile (node:internal/modules/cjs/loader:1761:14) at Object..js (node:internal/modules/cjs/loader:1893:10) at Module.load (node:internal/modules/cjs/loader:1481:32) at Module._load (node:internal/modules/cjs/loader:1300:12) at TracingChannel.traceSync (node:diagnostics_channel:328:14) at wrapModuleLoad (node:internal/modules/cjs/loader:245:24) at Module.executeUserEntryPoint [as runMain](node:internal/modules/run_main:154:5) at node:internal/main/run_main_module:33:47Node.js v24.11.1
============================C:\Users\ana\projects\taskkit\index.ts:3console.log("TaskKit", verison); ^ReferenceError: verison is not defined at Object.<anonymous> (C:\Users\ana\projects\taskkit\index.ts:3:24) at Module._compile (node:internal/modules/cjs/loader:1761:14) at Object..js (node:internal/modules/cjs/loader:1893:10) at Module.load (node:internal/modules/cjs/loader:1481:32) at Module._load (node:internal/modules/cjs/loader:1300:12) at TracingChannel.traceSync (node:diagnostics_channel:328:14) at wrapModuleLoad (node:internal/modules/cjs/loader:245:24) at Module.executeUserEntryPoint [as runMain](node:internal/modules/run_main:154:5) at node:internal/main/run_main_module:33:47Node.js v24.11.1
============================/home/ana/projects/taskkit/index.ts:3console.log("TaskKit", verison); ^ReferenceError: verison is not defined at Object.<anonymous> (/home/ana/projects/taskkit/index.ts:3:24) at Module._compile (node:internal/modules/cjs/loader:1761:14) at Object..js (node:internal/modules/cjs/loader:1893:10) at Module.load (node:internal/modules/cjs/loader:1481:32) at Module._load (node:internal/modules/cjs/loader:1300:12) at TracingChannel.traceSync (node:diagnostics_channel:328:14) at wrapModuleLoad (node:internal/modules/cjs/loader:245:24) at Module.executeUserEntryPoint [as runMain](node:internal/modules/run_main:154:5) at node:internal/main/run_main_module:33:47Node.js v24.11.1
Output (the first lines)text
/Users/ana/projects/taskkit/index.ts:4console.log("TaskKit, version);console.log("Your tasks, in your terminal");^^^^^^^console.log("============================");SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expected ',', got 'console'
C:\Users\ana\projects\taskkit\index.ts:4console.log("TaskKit, version);console.log("Your tasks, in your terminal");^^^^^^^console.log("============================");SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expected ',', got 'console'
/home/ana/projects/taskkit/index.ts:4console.log("TaskKit, version);console.log("Your tasks, in your terminal");^^^^^^^console.log("============================");SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expected ',', got 'console'
Exercise · Fix the error
Fix the first error, then the next
Check refuses this program. Fix what the first error names,
check again, and fix what is left, so it prints its three lines.