Cannot execute npm packages installed globally on Windows 10 machine

After installing typescript and nodemon on my Windows 10 machine using the typical npm install -g [package-name] command, I encountered a problem. When attempting to run them through the terminal, an application selector window would open prompting me to choose which app to use to open the file.

Does anyone have advice on how to resolve this issue? Could it possibly be related to Visual Studio being installed? Any assistance would be greatly appreciated.

Thank you in advance!

Answer №1

Alright, I have come across a couple of solutions to address this issue.

Identified problem

The packages mentioned previously contain files that are specifically designed for Unix shell environments and lack Windows batch scripts for execution. For instance:

https://i.sstatic.net/gsnaG.png

Possible fixes

  1. Create a file (if tsc in the

    C:\Users\[username]\AppData\Roaming\npm\node_modules\typescript\bin
    directory) called tsc.cmd and include the following code inside:

    @node "%~dpn0" %*

  2. Alternatively, you can use Git Bash which worked seamlessly for me right from the start :)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to open modal externally without encountering an error in MaterializeCSS

I'm currently facing an issue with a standard modal that pops up at the bottom of the page. I have a function that generates multiple components on the page, each with a 'play' button. When this button is clicked, it triggers a function pass ...

I am facing difficulty in deploying my Next.js app with Firestore

Having trouble deploying my application using npm run build, Vercel, or another service. It works fine locally without showing any errors. I am using Firebase, Next.js, and TypeScript. The issue seems to be related to getStaticProps. When requesting data, ...

The behavior of TypeScript class inheritance differs from that of its ES6 equivalent

I'm currently developing a custom error handling middleware for my node.js project using express and TypeScript. One key component of this middleware is the AppError class, which extends the built-in Error class. The code for this class is as follows: ...

The Npm installation encountered a failure as a result of MaxListenersExceededWarning, with 11 close listeners being added to [TLSSocket]

While setting up the GitHub repository [expensify/App] on my local machine and installing npm packages, I encountered errors in my console log. The errors are related to possible EventEmitter memory leak detection and directory cleanup failures. (node:1718 ...

How can I efficiently map an array based on multiple other arrays in JavaScript/TypeScript using ES6(7) without nested loops?

I am dealing with 2 arrays: const history = [ { type: 'change', old: 1, new: 2 }, { type: 'change', old: 3, new: 4 }, ]; const contents = [ { id: 1, info: 'infor1' }, { id: 2, info: 'infor2' }, { id: ...

Can a user be switched on npm?

When it comes to editing my profile, I find it straightforward and user-friendly. However, I have noticed that there is no option to change my username on npmjs.com. I am currently exploring methods to update my npm username. One solution I have considere ...

Encountering issues with launching the React App, it displays an error instead

While trying to set up a React app, I followed all the steps to create the necessary files and folders in the environment. However, when running the npm start command, an error occurred: C:\Users\name\myfirstreact>npm start $ react-script ...

Building an NPM module specifically designed for Ionic app development requires a strategic approach

Currently, I am in the process of creating a library for Ionic 2 that needs to be installed via NPM. However, I am facing some challenges with the traditional installation method. When trying to develop a module, you can usually use the npm link command to ...

Utilizing Windows Batch scripting to extract data for ffmpeg manipulation

I am faced with the task of parsing through multiple json files to extract specific values and use them in an ffmpeg command. Here is a sample json file structure: { "year": "2018", "track": "12", ... other ...

What causes material-ui to consume excessive amounts of space?

My React project is being bundled using webpack, with a dependency on material-ui for the following components: material-ui/Dialog material-ui/styles/getMuiTheme material-ui/styles/MuiThemeProvider material-ui/FlatButton material-ui/TextField The webpack ...

Get the @types definition installed from a forked repository

Background Information I recently made a workaround for a single type definition in my fork of DefinitelyTyped. This fix is located on a specific branch within my fork. It's important to note that this fix is temporary and should not be merged back ...

When trying to install npm using the command `npm install`, an error occurred with the message: "gyp verb 'which'

Encountering an issue on Ubuntu 21.10 where Python2.x is missing and trying to run "npm install" on a large project results in the following error (relevant lines from package.json shown below: ... "devDependencies": { ... "sass&qu ...

Having trouble running ng e2e on TeamCity with an @angular/cli script that refuses to cooperate

While using TeamCity 10, I encountered an issue with running an @angular/cli project during a build step. Everything worked smoothly until the e2e script was executed, causing the build to halt and require a forced shutdown. To troubleshoot, I accessed my ...

There is an issue with the property 'updateModf' in the constructor as it does not have an initializer and is not definitely assigned

When working with an angular reactive form, I encountered an issue. After declaring a variable with the type FormGroup like this: updateModf:FormGroup; , the IDE displayed an error message: Property 'updateModf' has no initializer and is not def ...

Having trouble accessing a custom factory within a directive in Angular using TypeScript

Having some trouble with my injected storageService. When trying to access it in the link function using this.storageService, I'm getting an undefined error. Any assistance on this issue would be greatly appreciated. module App.Directive { import ...

What should be the output when ending the process using process.exit(1)?

I need to update my code by replacing throw new Error('Unknown command.') with a log statement and process.exit(1);. Here is the example code snippet: private getCommandByName = (name: string): ICommand => { try { // try to fetch ...

Issue TS7053 occurs when trying to access any index of the target of a React.FormEvent<HTMLFormElement>

I've been working on adapting this tutorial to React and TypeScript. Here is the code snippet I have implemented for handling the onSubmit event: const handleSignUp = (event: React.FormEvent<HTMLFormElement>) => { event.preventDefault(); ...

Creating personalized properties for a Leaflet marker using Typescript

Is there a way to add a unique custom property to each marker on the map? When attempting the code below, an error is triggered: The error "Property 'myCustomID' does not exist on type '(latlng: LatLngExpression, options?: MarkerOptions) ...

Guide to successfully submitting an Angular form that includes a nested component

I have developed a custom dateTime component for my application. I am currently facing an issue where I need to integrate this component within a formGroup in a separate component. Despite several attempts, I am unable to display the data from the child fo ...

The React Component in Next.js does not come equipped with CSS Module functionality

I have been attempting to incorporate and apply CSS styles from a module to a React component, but the styles are not being applied, and the CSS is not being included at all. Here is the current code snippet: ./components/Toolbar.tsx import styles from & ...