【问题标题】:npm installing old versions of (typescript compiler) packagenpm 安装旧版本的(打字稿编译器)包
【发布时间】:2017-02-17 21:22:07
【问题描述】:

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

我的本​​地打字稿版本是: npm run tsc -v 3.10.8

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

npm install tsc -g tsc -v 我的 typescript 编译器得到了 1.5.3 版本

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

npm 错误! notarget 未找到兼容版本:tsc@3.10.8 npm 错误! notarget 有效的安装目标: npm 错误!无目标 1.20150623.0、1.20150622.0、1.20150619.0、1.0.0 `

顺便说一句,我默认安装了节点,我的 npm 版本是 2,但我可以将它更新到 3.10.8,这样就可以了。但是对于打字稿,没办法。

有什么想法吗?

PS:我的平台是windows 10

【问题讨论】:

    标签: node.js windows npm npm-install tsc


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      你需要安装的不是 tsc 而是 typescript npm uninstall -g tsc npm install -g typescript

      【讨论】:

        猜你喜欢
        • 2019-12-29
        • 1970-01-01
        • 2017-12-16
        • 2022-01-25
        • 1970-01-01
        • 2013-06-09
        • 1970-01-01
        • 2020-03-25
        相关资源
        最近更新 更多