FedoraRHEL Based

How To Install TypeScript on Fedora 43

Install TypeScript on Fedora 43

TypeScript has quietly become the default choice for serious JavaScript development. If you’re running Fedora 43 and need a typed, scalable language for your next project, you’re in the right place. This guide walks you through everything you need to install TypeScript on Fedora 43 — from prepping your system to writing and compiling your first .ts file.

Prerequisites

  • Operating System: Fedora 43 (tested on Fedora 43 Workstation and Server editions)
  • User permissions: A non-root user with sudo privileges, or root access
  • Internet connection: Required to download packages
  • Terminal access: GNOME Terminal, Konsole, or any shell emulator
  • Basic comfort: Familiarity with running commands in a terminal (beginner-level is fine)

No prior TypeScript experience is required. This tutorial builds everything from the ground up.

Step 1: Update Your Fedora 43 System

The first thing any sysadmin does before installing new software is update the system. Stale packages cause dependency conflicts that are frustrating to debug later.

Run this command to refresh all packages:

sudo dnf update -y

What this does: dnf update fetches the latest metadata from Fedora’s repositories and upgrades all installed packages. The -y flag auto-confirms prompts so you don’t have to sit there pressing Enter.

Expected output:

Last metadata expiration check: 0:00:12 ago on Tue 03 Mar 2026 04:45:00 AM WIB.
Dependencies resolved.
Nothing to do.
Complete!

If you see kernel updates in the list, reboot your system before continuing:

sudo reboot

Verify Your Fedora Version

After rebooting (or if you skipped it), confirm you’re running Fedora 43:

cat /etc/fedora-release

Expected output:

Fedora release 43 (Forty Three)

Security note: Keeping your system updated is one of the most important security practices on any Linux system. Outdated packages often carry known CVEs that attackers actively exploit.

Step 2: Install Node.js and npm on Fedora 43

TypeScript requires Node.js and npm (Node Package Manager) to run. npm is the tool that actually installs TypeScript from the registry.

Fedora 43’s DNF repositories include Node.js out of the box. This is the fastest method for most users.

Method A: Install via DNF (Recommended for Most Users)

sudo dnf install nodejs -y

Starting from Fedora 24, npm ships bundled with the Node.js package — you don’t need to install it separately.

Verify the installation:

node -v
npm -v

Expected output:

v22.x.x
10.x.x

The DNF method gives you a stable, system-wide Node.js installation that integrates cleanly with Fedora’s package management.

Method B: Install a Specific Node.js Version via NVM (Recommended for Developers)

If you work on multiple projects that require different Node.js versions, NVM (Node Version Manager) is the better option. It lets you switch between Node.js versions without touching your system installation.

First, install NVM using the official install script:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

After the script runs, reload your shell environment:

source ~/.bashrc

If you use Zsh instead of Bash:

source ~/.zshrc

Now install the latest LTS version of Node.js:

nvm install --lts

Set it as your default:

nvm use --lts
nvm alias default node

Verify:

node -v
npm -v

💡 Pro Tip: Use NVM if you’re a developer juggling multiple projects. Use the DNF method if you’re a sysadmin setting up a server where simplicity and system integration matter more than version flexibility.

Step 3: Install TypeScript on Fedora 43 via npm

With Node.js and npm ready, you can now install TypeScript. The recommended approach is a global installation using npm, which makes the tsc compiler available system-wide.

npm install -g typescript

What this does: The -g flag tells npm to install TypeScript globally, placing the tsc binary in your system PATH so you can run it from any directory.

Expected output:

added 1 package in 3s
1 package is up to date

Verify TypeScript Installation

tsc --version

Expected output:

Version 5.9.x

As of early 2026, TypeScript 5.9.x is the latest stable release. If you need to confirm you have the absolute latest version, run:

npm show typescript version

This queries the npm registry and returns the current published version without installing anything.

Step 4: Configure TypeScript Fedora 43 Setup

Installing TypeScript is only half the job. A proper TypeScript on Fedora 43 setup requires a tsconfig.json file that tells the compiler how to behave. Without it, tsc uses default settings, which are rarely ideal for real projects.

Create a Project Directory

mkdir ~/my-typescript-project
cd ~/my-typescript-project

Initialize a TypeScript Configuration File

tsc --init

This generates a tsconfig.json file in your current directory with all available options listed (most commented out).

Expected output:

Created a new tsconfig.json with:
  target: es2016
  module: commonjs
  strict: true
  esModuleInterop: true
  skipLibCheck: true
  forceConsistentCasingInFileNames: true

Review and Edit tsconfig.json

Open the file with your preferred editor:

nano tsconfig.json

Here’s a practical baseline configuration for a Fedora 43 Linux server tutorial project:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

Key options explained:

  • "target": "ES2020" — Compiles your TypeScript down to ES2020-compatible JavaScript
  • "outDir": "./dist" — Places compiled .js files in a /dist folder
  • "rootDir": "./src" — Tells TypeScript your source files live in /src
  • "strict": true — Enables all strict type-checking rules (highly recommended)
  • "exclude": ["node_modules"] — Prevents TypeScript from trying to compile your dependencies

Create the source directory:

mkdir src

Verify your config is valid:

tsc --showConfig

This prints the resolved configuration TypeScript will actually use, including inherited defaults.

Step 5: Write and Compile Your First TypeScript File

Now let’s confirm the entire pipeline works end-to-end. This step also gives you a concrete reference point for future projects.

Create a Test TypeScript File

nano src/index.ts

Add this content:

interface User {
  name: string;
  age: number;
  isAdmin: boolean;
}

function greetUser(user: User): string {
  return `Hello, ${user.name}! You are ${user.age} years old.`;
}

const adminUser: User = {
  name: "GoDeT",
  age: 30,
  isAdmin: true,
};

console.log(greetUser(adminUser));

Save and exit (Ctrl+O, Enter, Ctrl+X in nano).

Compile TypeScript to JavaScript

tsc

TypeScript reads your tsconfig.json, finds src/index.ts, and compiles it to dist/index.js.

Verify the output file was created:

ls dist/

Expected output:

index.js

Run the Compiled JavaScript

node dist/index.js

Expected output:

Hello, GoDeT! You are 30 years old.

Your TypeScript setup on Fedora 43 is fully working.

Step 6: Set Up npm Scripts to Configure TypeScript Fedora Workflow

Running tsc manually every time is tedious. Most developers use npm scripts and a watch mode to automate compilation during development. This step covers how to configure TypeScript Fedora workflows that save real time.

Initialize a package.json

npm init -y

This creates a package.json with default values in your project root.

Add TypeScript as a Local Dev Dependency

Even though TypeScript is installed globally, locking a version to your project avoids “works on my machine” problems with teammates:

npm install --save-dev typescript

What this does: Adds TypeScript to your devDependencies in package.json. The --save-dev flag marks it as a development-only dependency that won’t ship to production.

Add npm Scripts to package.json

Open package.json:

nano package.json

Edit the "scripts" section:

"scripts": {
  "build": "tsc",
  "build:watch": "tsc --watch",
  "start": "node dist/index.js",
  "dev": "tsc --watch & node --watch dist/index.js"
}

Now you can use:

npm run build        # Compile once
npm run build:watch  # Compile automatically on file changes
npm start            # Run the compiled output

Install ts-node for Direct Execution (Optional)

ts-node lets you run TypeScript files directly without compiling first — extremely useful during development:

npm install --save-dev ts-node

Run TypeScript directly:

npx ts-node src/index.ts

Expected output:

Hello, GoDeT! You are 30 years old.

Verify the full project structure looks correct:

ls -la

Expected output:

drwxr-xr-x. dist/
drwxr-xr-x. node_modules/
drwxr-xr-x. src/
-rw-r--r--. package.json
-rw-r--r--. package-lock.json
-rw-r--r--. tsconfig.json

Security note: Never commit your node_modules/ directory to version control. Add it to .gitignore immediately. Run echo "node_modules/" >> .gitignore to do this in one command.

Step 7: Keep TypeScript Updated on Fedora 43

The TypeScript team ships frequent updates. Staying current means you get new language features, performance improvements, and bug fixes.

Check the Currently Installed Version

tsc --version

Update the Global TypeScript Installation

npm install -g typescript@latest

Update the Project-Local TypeScript

Inside your project directory:

npm update typescript

Or pin a specific version:

npm install --save-dev typescript@5.9

Verify the update:

tsc --version

If the global and local versions differ, Node.js resolves the local one when running commands via npx or npm scripts. This is intentional — it keeps project environments isolated.

Troubleshooting Common Errors

Even clean installations hit snags. Here are the five most common issues when you configure TypeScript Fedora environments, and how to fix them.

Error 1: tsc: command not found

Symptom:

bash: tsc: command not found

Cause: The npm global bin directory is not in your PATH.

Fix: Add it manually:

export PATH="$PATH:$(npm bin -g)"

To make this permanent, add it to your shell profile:

echo 'export PATH="$PATH:$(npm bin -g)"' >> ~/.bashrc
source ~/.bashrc

If you used NVM, also check that your shell config sources NVM correctly. Look for these lines in ~/.bashrc:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

Error 2: Permission Denied During Global npm Install

Symptom:

npm ERR! Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/typescript'

Cause: Attempting to install globally as a non-root user without proper permissions.

Fix (preferred — change npm’s global directory):

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
npm install -g typescript

This installs TypeScript in your home directory, avoiding the need for sudo entirely. Avoid using sudo npm install -g — it changes file ownership in ways that can break future npm operations.

Error 3: TypeScript Compiles But Output Is Wrong ES Version

Symptom: Your compiled JavaScript uses var instead of const/let, or lacks async/await support.

Cause: The "target" in tsconfig.json is set too low (e.g., "ES5").

Fix: Open tsconfig.json and change:

"target": "ES2020"

Recompile:

tsc

For Node.js 18+ environments on Fedora 43, "ES2020" or "ES2022" is the right target.

Error 4: Cannot find module After Compilation

Symptom:

Error: Cannot find module './utils'

Cause: Missing file extensions in import paths, or misconfigured rootDir/outDir.

Fix: Check that your tsconfig.json has correct paths:

"rootDir": "./src",
"outDir": "./dist"

Also verify your import uses the right relative path:

import { myFunc } from './utils';  // No .ts extension needed

If the file exists but TypeScript still can’t find it, run tsc --traceResolution to see exactly where it’s looking.

Error 5: node_modules/@types Errors on Fresh Install

Symptom:

TS2688: Cannot find type definition file for 'node'.

Cause: Missing Node.js type definitions.

Fix: Install the @types/node package:

npm install --save-dev @types/node

This gives TypeScript full type information for Node.js built-in modules like fs, path, and http. After installing, run tsc again and the errors should clear.

Congratulations! You have successfully installed TypeScript. Thanks for using this tutorial for installing TypeScript programming language on Fedora 43 Linux system. For additional help or useful information, we recommend you check the official TypeScript website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a dedicated and highly skilled Linux Systems Administrator with over a decade of progressive experience in designing, deploying, and maintaining enterprise-grade Linux infrastructure. His professional journey began in the telecommunications industry, where early exposure to Unix-based operating systems ignited a deep and enduring passion for open-source technologies and server administration.​ Throughout his career, r00t has demonstrated exceptional proficiency in managing large-scale Linux environments, overseeing more than 300 servers across development, staging, and production platforms while consistently achieving 99.9% system uptime. He holds advanced competencies in Red Hat Enterprise Linux (RHEL), Debian, and Ubuntu distributions, complemented by hands-on expertise in automation tools such as Ansible, Terraform, Bash scripting, and Python.
Back to top button