Reputation: 13539
My package.json has Typescript set like this :
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.3",
"typescript": "^3.9.10"
},
If I try to update to the latest typescript using this command :
npm install -g typescript@latest
I would expect my typescript entry to update to 4.5 or whatever it is.
After I run the install the package.json still displays typescript like this :
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.3",
"typescript": "^3.9.10"
},
Why is this so? This is not how I understand NPM to work.
Upvotes: 1
Views: 575
Reputation: 667
The reason the package.json
didn't update is that you provided the --global
or -g
flag to NPM in a local directory. When this flag is specified, NPM makes all executables in a package available in the PATH
so you can run it on the command line. In other words, this is just updating your tsc
command that you can run in the terminal. Removing that flag will update it in the local directory. Just run the same command like this:
npm install typescript@latest
Upvotes: 2