What could be the reason for the 'tsc' command not functioning in the Git Bash terminal but working perfectly in the command prompt?

I recently installed TypeScript globally on my machine, but I am facing an issue while trying to use it in the git bash terminal.

Whenever I run tsc -v, I encounter the following error:

C:\Users\itupe\AppData\Roaming\npm/node: line 8:
C:\Users\itupe\AppData\Roaming\npm/node_modules/node/bin/node: No such file or directory

Interestingly, when I try the same command in the command prompt, everything works perfectly fine.

I have been browsing through various sources online to understand more about paths and configurations, but I am still unable to resolve this confusion. Can someone provide insight into why this discrepancy exists?

Answer №1

It appears that there may be a missing path for npm in git bash.

To troubleshoot, you can verify your PATH variable in Git Bash by running:

echo $PATH

Check to see if the directory

C:\Users\itupe\AppData\Roaming\npm
is included in the PATH.

Also, ensure that Git Bash is using the same version of Node.js as your command prompt by executing:

node -v

Confirm whether the command prompt and git bash are both utilizing the same node js version.

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

Increase the size of the NativeScript switch component

Here is the code I am working with: .HTML <Switch style="margin-top: 10" (checkedChange)="onFirstChecked1($event)" row="0" col="1" horizontalAlignment="center" class="m-15 firstSwitchStyle"></Switch> .CSS .firstSwitchStyle{ width: 30%; ...

Error message: A syntax error has occurred due to a type error, which prevents the program from reading properties that are undefined, specifically 'spaces'. To

Hey, I'm encountering a peculiar issue while running $npm run serve https://i.stack.imgur.com/mPzw7.png Check out my page layout below: <template> <div> ... </div> </template> <script> export default { name: ...

Tips for updating the name of a variable (such as 'data') following the process of destructuring, like with the

If I have 2 SWR hooks in the same function (or some other hook that contains a data variable), export default function Panel() { const { data, error } = useSWR("/api/customer", fetcher); const { data, error } = useSWR("/api/user", fetch ...

The Vuex this.$store is not defined in the "mounted" lifecycle hook of the component

Currently in the process of integrating Paypal into my Vue project, following the official documentation and copying the necessary code from here. Successfully rendered the Paypal button, completed the transaction, and obtained an orderID. However, encount ...

I would greatly appreciate any recommendations on how to troubleshoot and

I've been working on the "Map the Debris" challenge at freecodecamp, and I'm facing an issue. While my code works fine in my PC's editor, it doesn't satisfy the conditions when I paste it into the website area. Any suggestions on how t ...

Tailwind does not display font sizes using random values

I am attempting to adjust the size of a span element based on a number from a variable: export default async function Tags() { const tags = await getTags(); return ( <div> <Suspense> <div className="flex flex-wrap ...

Ways to utilize the $npm_config_ within the package.json file?

For my React project, I am using `create-react-app` (ejected) and have set up a proxy in the `package.json` file. However, I do not want to include my credentials in this file. Instead, I added them to npm using the command `npm config set my_user xxxx`. T ...

iOS 10.3.1 causing Ionic 2 (click) event to trigger twice

I am currently working on an Ionic 2 app and I am facing an issue with the click event. When I test the app on a device and click on a button, let's say to trigger an alert, the function executes once. However, if I click on the button again, the fun ...

Cease the loading of a script in an HTML file

I have encountered a challenge in preventing a script from loading on my Wordpress website. The HTML file contains two scripts: <script type="0f1a6d7ca503db410c0d10c4-text/javascript" src='https://www.[-----------].se/wp-content/plugins/ ...

Node.js/NPM issue on Windows machine

I've encountered a situation where all npm commands are getting stuck indefinitely, no matter how long I wait. This issue seems to occur after using npm for a while. Currently, the only solution I have is to restart my PC (yes, resorting to Windows f ...

What could be causing my webpage to automatically refresh following a POST request in NodeJS?

Utilizing the express framework alongside NodeJS, I have encountered an issue where my client webpage refreshes after making a POST request that triggers a python script and returns a JSON object to the client. My dilemma lies in preventing this automatic ...

Struggling to display my array data retrieved from the database on my Angular 5 page

I hope everyone is doing well. I am currently facing a problem with retrieving data from Firebase. I have an array within an array and I want to display it in my view, but I am encountering difficulties. Let me share my code and explain what I am trying to ...

Using Angular BehaviorSubject in different routed components always results in null values when accessing with .getValue or .subscribe

I am facing an issue in my Angular application where the JSON object saved in the service is not being retrieved properly. When I navigate to another page, the BehaviorSubject .getValue() always returns empty. I have tried using .subscribe but without succ ...

A directive containing a template

I'm facing a unique challenge where I have to nest a template inside another template within my directive. The issue arises because AngularJS doesn't recognize ng-repeat code inside attributes. In an ideal scenario, here is how I envision my cod ...

Creating a separation between Mongoose data access code and pure data objects in Node.JS using Object-Oriented Programming

I've stumbled upon a design dilemma regarding Mongoose - could it be that my approach is off? In the traditional OOP fashion, I aim to create a User class. This class includes various attributes such as username, firstname, lastname, salt, and hash, ...

The Vue version is not available on any npm registry

After spending some time coding with vue and node, I returned to my Windows 10 system and started using Git Bash I checked the version of Node installed on my Windows system: $ node -v v12.14.1 Next, I tried installing Vue and Vuex: $ npm vue -v 6.13.4 ...

The ng-repeat ng-switch combination is not functioning as expected

My data can be simplified to the following in my code: function DemoCtrl($scope) { $scope.myData= [ {text: "blah", other: 3, V: 'caseOne'}, {text: "blah", other: 3, V: 'caseTwo'}, {text: "blah", other: 3, V ...

The functionality of getAttribute has changed in Firefox 3.5 and IE8, no longer behaving as it did before

Creating a JavaScript function to locate an anchor in a page (specifically with, not an id) and then going through its parent elements until finding one that contains a specified class. The code below works perfectly in Firefox 3.0 but encounters issues wi ...

Encountering issues with JSON.Parse in JavaScript leads to errors

I'm encountering issues with JSON parsing in my code and I can't figure out the cause of it. I have a function that calls two ajax functions, one at the start and another in the success function. Everything seems to be working fine until I try to ...

Utilizing Google Tag Manager for Efficiently Managing Multiple Schema Product Reviews with JSON-LD and Variables

Currently, I am facing a challenge while using Google Tag Manager to incorporate Schema JSON-LD Product reviews on certain pages. Despite my efforts, I am unable to locate any relevant resources to resolve this issue. The main problem lies in informing GT ...