npm installing old versions of (typescript compiler) package

半腔热情 提交于 2020-01-15 03:54:09

问题


On a windows environment, I have: node v4.6.0 npm v3.10.8

my local typescript version is: npm run tsc -v 3.10.8

However, I sometimes want to use my global tsc (because for some reason, gulp uses the global tsc) but when I do:

npm install tsc -g tsc -v I get a version 1.5.3 for my typescript compiler

when I try to force install it to the exact version I need: npm install tsc@3.10.8 -g I get: ` npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\DT\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "tsc@3.10.8" "-g" npm ERR! node v4.6.0 npm ERR! npm v3.10.8 npm ERR! code ETARGET

npm ERR! notarget No compatible version found: tsc@3.10.8 npm ERR! notarget Valid install targets: npm ERR! notarget 1.20150623.0, 1.20150622.0, 1.20150619.0, 1.0.0 `

Btw with my default installation of node, my npm version is 2 something but I can update it to 3.10.8, that works. For typescript however, no way.

Any ideas?

PS:my platform is windows 10


回答1:


Had the same problem and this worked for me:

  1. Go to "C:\Program Files (x86)\Microsoft SDKs" and delete the TypeScript folder.
  2. Uninstall previous version (npm uninstall -g typescript)
  3. Reinstall typescript.


来源:https://stackoverflow.com/questions/39941592/npm-installing-old-versions-of-typescript-compiler-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!