首页 > 解决方案 > 无法使用 npm 在 MacOS 上安装 Typescript

问题描述

我一直在尝试使用以下命令在我的 Mac 上全局安装 Typescript:

npm install -g typescript

并且:

sudo npm install -g typescript

但是每次我尝试检查它是否安装正确时,我都会使用tsc -v得到以下错误:

/usr/local/lib/node_modules/typescript/lib/tsc.js:5970
    var textToKeyword = new ts.Map(ts.getEntries(textToKeywordObj));
                        ^

TypeError: Iterator value undefined is not an entry object
    at new Map (native)
    at ts (/usr/local/lib/node_modules/typescript/lib/tsc.js:5970:25)
    at Object.<anonymous> (/usr/local/lib/node_modules/typescript/lib/tsc.js:7892:3)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)

任何人都可以提供有关如何解决此问题的任何指导吗?

谢谢你的时间。

标签: typescriptmacosnpm

解决方案


推荐阅读