npm 安装旧版本的(打字稿编译器)包 [英] npm installing old versions of (typescript compiler) package

查看:56
本文介绍了npm 安装旧版本的(打字稿编译器)包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 环境中,我有:节点 v4.6.0npm v3.10.8

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

我的本​​地打字稿版本是:<代码>npm 运行 tsc -v3.10.8

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

但是,有时我想使用我的全局 tsc(因为出于某种原因,gulp 使用全局 tsc)但是当我这样做时:

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

<代码>npm 安装 tsc -gtsc -v我的打字稿编译器获得了 1.5.3 版

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

当我尝试将其强制安装到我需要的确切版本时:<代码>npm 安装 tsc@3.10.8 -g我得到:`npm 错误!Windows_NT 10.0.14393npm 错误!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 错误!节点 v4.6.0npm 错误!npm v3.10.8npm 错误!代码ETARGET

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 错误!notarget 未找到兼容版本:tsc@3.10.8npm 错误!notarget 有效的安装目标:npm 错误!无目标 1.20150623.0、1.20150622.0、1.20150619.0、1.0.0`

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 `

顺便说一句,我默认安装了 node,我的 npm 版本是 2,但我可以将它更新到 3.10.8,这有效.然而,对于打字稿,没办法.

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.

有什么想法吗?

PS:我的平台是 windows 10

PS:my platform is windows 10

推荐答案

遇到了同样的问题,这对我有用:

Had the same problem and this worked for me:

  1. 转到C:\Program Files (x86)\Microsoft SDKs"并删除 TypeScript 文件夹.
  2. 卸载以前的版本(npm uninstall -g typescript)
  3. 重新安装打字稿.

这篇关于npm 安装旧版本的(打字稿编译器)包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆