编译打字稿时找不到“tsc 命令" [英] 'tsc command not found' in compiling typescript
问题描述
我想安装打字稿,所以我使用了以下命令:
I want to install typescript, so I used the following command:
npm install -g typescript
并测试tsc --version
,但它只显示'tsc command not found'.我已经按照 stackoverflow、github 和其他站点中的建议尝试了很多方法.但它不起作用.我怎么知道安装了 typescript 以及它在哪里.
and test tsc --version
, but it just show 'tsc command not found'. I have tried many ways as suggested in stackoverflow, github and other sites. but it doesn't work. How could I know typescript is installed and where it is.
我的操作系统是 Unix,OS X El Capitan 10.11.6,节点版本为 4.4.3,npm 版本是 3.10.5
my OS is Unix, OS X El Capitan 10.11.6, node version is 4.4.3, npm version is 3.10.5
推荐答案
一些小技巧
- 重启终端
- 重启机器
- 重新安装 nodejs + 然后运行
npm install typescript -g
如果仍然不起作用,请运行 npm config get prefix
以查看 npm install -g 放置文件的位置(将 bin
附加到输出)并确保它们在路径中(节点 js 设置执行此操作.也许您忘记勾选该选项).
If it still doesn't work run npm config get prefix
to see where npm install -g is putting files (append bin
to the output) and make sure that they are in the path (the node js setup does this. Maybe you forgot to tick that option).
这篇关于编译打字稿时找不到“tsc 命令"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!