To install TypeScript on AlmaLinux, start with a supported Node.js runtime and add the compiler to your project as a development dependency. This keeps the compiler version with the code and makes local and CI builds easier to reproduce. You do not need a global compiler or root privileges for the project setup.
This walkthrough creates a small command-line project. An existing application may already have its own framework, package manager and module settings; follow those conventions rather than replacing its configuration with a tutorial.
cat /etc/os-release
node --version
npm --version
command -v node
command -v npm
If Node.js is missing, inspect the packages available from your approved repositories:
dnf info nodejs npm
On a machine where these packages provide the supported version your project needs, an administrator can install them with:
sudo dnf install nodejs npm
Review the proposed packages before accepting. Repository choices vary across AlmaLinux releases. Do not assume that a module-stream command copied from an older release applies to every system, or reset an existing stream without reviewing the applications that use it.
Check the Node.js release schedule and your dependencies’ runtime requirements. As reviewed in October 2026, Node.js 22 and 24 are LTS lines, while Node.js 20 has reached upstream end of life. Distribution maintenance policies can differ, so assess the package source as well as the major version.
Run the following as your ordinary development user in a new directory:
mkdir typescript-demo
cd typescript-demo
npm init -y
npm install --save-dev --save-exact typescript
npx tsc --version
The compiler is recorded in devDependencies. The exact version and lockfile capture the chosen dependency state. Review package lifecycle scripts and dependency sources under your normal supply-chain policy. Avoid using sudo npm install to solve a project ownership problem.
Create tsconfig.json with this minimal configuration. It uses a simple CommonJS output so the first example does not depend on an application framework:
{
"compilerOptions": {
"target": "ES2022",
"module": "CommonJS",
"rootDir": "src",
"outDir": "dist",
"strict": true,
"noEmitOnError": true
},
"include": ["src/**/*.ts"]
}
Create a src directory and save this as src/main.ts:
const message: string = "Hello from TypeScript on AlmaLinux";
console.log(message);
Compile the project and execute its generated JavaScript:
npx tsc -p tsconfig.json
node dist/main.js
Expected output is the greeting above. Specifying a project reads its configuration; passing individual source filenames to the compiler is a different invocation and does not apply the same project-file workflow.
In package.json, add or merge the following scripts while retaining the other fields:
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"start": "node dist/main.js"
}
npm run check
npm run build
npm start
A type-checking command should fail the build when the compiler reports errors. For example, assigning a number to the string variable is a useful temporary learning exercise. Restore the correct code afterward. Do not suppress compiler errors simply to make a pipeline green.
Commit the source, package.json, package-lock.json and configuration. Exclude generated dependency folders such as node_modules/ from source control. In a clean checkout with the agreed Node.js and npm versions, run:
npm ci
npm run check
npm run build
npm ci requires a lockfile consistent with the package manifest and replaces an existing dependency directory. It does not update the lockfile for you. Build jobs need development dependencies because that is where this compiler is installed.
npx tsc.type, compiler module setting and runtime. Existing ESM projects need an appropriate configuration, not a blind copy of this sample.No. Static types are not a substitute for validating untrusted inputs. Add runtime validation where data enters the application.
Upgrade deliberately in a branch, review the compiler’s release notes, and run application tests. To remove the local dependency, use npm uninstall --save-dev typescript and review the manifest and lockfile changes.
The Nandan Sinha newsletter
Get new articles on technology, practical guides, wellbeing and spirituality, delivered to your inbox.
Subscribe by email. Confirm your address to join. Unsubscribe anytime. Privacy policy.
We use essential cookies to run this website and optional cookies for analytics and advertising. Choose Accept All, Reject, or Preferences to manage optional cookies. You can change your choice at any time.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
These cookies are needed for adding comments on this website.
Google Tag Manager simplifies the management of marketing tags on your website without code changes.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
You can find more information in our Privacy Policy and Privacy Policy.

Leave a Reply