'Trying to upgrade TypeScript but old version still not uninstalling / being replaced
I am trying to upgrade TypeScript from 3.4.5 to 4.5.4 having migrated a NativeScript project from version 6.5.0 to 8.1.5.
Ideally to completely remove the old TypeScript 3.4.5 but it still seems to be there. I have checked the other similar queries like this one but have not been able to get rid of it. I do not have Visual Studio installed.
Am using nvm and am currently on node 16.10.0 and npm 7.24.0
My package.json has "typescript": "^4.5.4", in the dependencies. Here is the whole package.json.
{
"description": "Reports App | Mobile Expense Reports",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"scripts": {
"lint": "tslint \"app/**/*.ts\""
},
"dependencies": {
"@angular/animations": "~13.1.1",
"@angular/common": "~13.1.1",
"@angular/compiler": "~13.1.1",
"@angular/core": "~13.1.1",
"@angular/forms": "~13.1.1",
"@angular/http": "8.0.0-beta.10",
"@angular/platform-browser": "~13.1.1",
"@angular/platform-browser-dynamic": "~13.1.1",
"@angular/router": "~13.1.1",
"@master.technology/permissions": "~2.0.1",
"@nativescript-community/ui-material-bottom-navigation": "^6.2.11",
"@nativescript/angular": "~13.0.0",
"@nativescript/core": "~8.1.1",
"@nativescript/fingerprint-auth": "8.0.0",
"nativescript-app-sync": "^2.0.0",
"nativescript-bottom-navigation": "^2.0.5",
"nativescript-camera": "^4.5.0",
"nativescript-drop-down": "^6.0.1",
"nativescript-fancyalert": "~3.1.1",
"nativescript-fingerprint-auth": "~7.0.2",
"nativescript-fontawesome": "^1.0.0",
"nativescript-gradient": "^2.0.1",
"nativescript-imagepicker": "~7.1.0",
"nativescript-iqkeyboardmanager": "^1.5.1",
"nativescript-modal-datetimepicker": "~2.1.5",
"nativescript-pdf-view": "^3.0.0-1",
"nativescript-permissions": "~1.3.12",
"nativescript-theme-core": "~2.0.24",
"nativescript-toast": "^2.0.0",
"nativescript-ui-listview": "~10.0.2",
"reflect-metadata": "~0.1.10",
"ruby": "^0.6.1",
"rxjs": "~7.4.0",
"typescript": "^4.5.4",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.1.1",
"@angular/compiler-cli": "~13.1.1",
"@nativescript/android": "~8.1.1",
"@nativescript/webpack": "~5.0.0",
"@ngtools/webpack": "~13.1.1",
"@types/node": "14.6.2",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"codelyzer": "~4.5.0",
"extract-text-webpack-plugin": "~3.0.2",
"lazy": "1.0.11",
"sass": "~1.39.0",
"tslint": "~5.12.1",
"uglifyjs-webpack-plugin": "^2.2.0"
},
"main": "main.js"
}
I have tried many things like
npm uninstall -g typescript
npm install -g typescript
ns clean
npm install
And I still get
$ tsc -v
Version 3.4.5
I cannot see where it is pulling it from.
ng --version gives:
Angular CLI: 13.2.2
Node: 16.10.0
Package Manager: npm 7.24.0
OS: win32 x64
Angular: 13.1.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1301.4
@angular-devkit/build-angular 13.1.4
@angular-devkit/core 13.1.4
@angular-devkit/schematics 13.2.2 (cli-only)
@angular/http 8.0.0-beta.10+1.sha-a28b3e3
@ngtools/webpack 13.1.4
@schematics/angular 13.2.2 (cli-only)
rxjs 7.4.0
typescript 4.5.4
I also tried deleting node_modules, hooks and platforms and reinstalling but tsc still gives v3.4.5.
Can you see what version I am on?
======== UPDATE
I did it (in Windows) by deleting the
C:\Users\User\AppData\Roaming\npm\node_modules\typescript
folder and replacing it with the
C:\Program Files\nodejs\node_modules\typescript
folder.
I think when running
npm i -g typescript
NVM was saving it to
C:\Program Files\nodejs\node_modules
and
C:\Users\User\AppData\Roaming\nvm\v16.10.0\node_modules
but not
C:\Users\User\AppData\Roaming\npm\node_modules
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
