I encountered an error while installing TypeScript 7

Falanga, Rod, DOH 1,210 Reputation points
2026-09-25T16:10:18.0033333+00:00

I tried to install TypeScript 7 by using this command at a PowerShell 7 prompt:

npm install -D typescript

However, it failed giving me this error message:

npm error Error: EPERM: operation not permitted, mkdir 'C:'

Must TypeScript 7 be installed at the root level of the drive in Windows 11 Enterprise?

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments

Answer accepted by question author

AI answer

2026-09-25T16:10:32.5433333+00:00

No. TypeScript 7 does not need to be installed at the root of the drive.

In Visual Studio, TypeScript support is added by installing the TypeScript npm package into the project, and Visual Studio uses the local project version for the language service when it is installed through npm. The documented commands are:

npm install -D typescript@^6.0.0

or, for the TypeScript 7 native preview language service:

npm install -D @typescript/native-preview@beta

The EPERM: operation not permitted, mkdir 'C:\' error indicates npm is trying to create something at C:\, which is a permissions/location problem, not a requirement for TypeScript 7.

Checks to make:

  1. Run the install from the project root, where package.json is located.
  2. Open package.json in the project root and confirm TypeScript is being added there as a dev dependency.
  3. Check the npm option in the Output window to verify package installation progress and errors if using Visual Studio.
  4. Check for npm package issues or version problems in the npm Output window.
  5. If npm cache or environment settings were changed, restart open console windows or reboot so the new values apply.

If the npm cache was redirected, the documented example is to set it to a folder such as D:\packages\npm, not to C:\.


AI-generated content may be incorrect. Read our transparency notes for more information.

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Chen Tran 13,030 Reputation points Independent Advisor
    2026-09-25T16:53:53.4466667+00:00

    Hello Falanga,

    Thank you for posting question on Microsoft Windows Forum!

    Well! The fact of the matter is that TypeScript does not need to be installed at the root level of your drive. The error message npm error Error: EPERM: operation not permitted, mkdir 'C:' does not mean TypeScript requires root access. Instead, it indicates that npm evaluated a malformed or empty path (evaluating to just 'C:') and tried to create a directory directly at the root of your drive, which Windows 11 Enterprise blocks due to standard security permissions.

    If you ran npm install -D typescript in a directory that does not have a package.json file initialized, npm can become confused about where to resolve local paths or flags, sometimes resulting in malformed path parsing. On the other hand, an older version of npm interacting with PowerShell can occasionally misinterpret local installation flags.

    The suggested approach is to make sure you are inside an actual project folder that contains a package.json file. If you have not created one yet, run this command npm init -y . Once your project is initialized, run your local install command again npm install -D typescript

    In case the error persists, update your npm package manager to the latest version to clear out parsing bugs by running this command npm install -g npm@latest

    Hope the response provided some helpful insight. If you find this answer useful, please feel free to hit “Accept Answer” so I know it addressed your concern.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.