找不到模块"ts-node/register" [英] Cannot find module 'ts-node/register'

查看:2242
本文介绍了找不到模块"ts-node/register"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用mocha来测试我的TypeScript/Angular2项目.我尝试按照此处:

I want to use mocha to test my TypeScript/Angular2 project. I tried to use ts-node as described here:

npm install -g ts-node

但是运行时

mocha --require ts-node/register -t 10000 ./**/*.unit.ts

我收到错误

找不到模块"ts-node/register"

Cannot find module 'ts-node/register'

我在这里想念什么?

推荐答案

由于对很多人有用的答案似乎隐藏在注释中,因此我将其发布为该问题的实际答案,因为看来问题已被重新打开.

Since the answer that works for a lot of people appears to be hidden in the comments, I'll post it as an actual answer to the question, now that it appears the question has been reopened.

我也有这个问题.不确定为什么关闭了此Q.但是在本地安装ts-node可以解决此问题. npm install ts-node --save-dev

感谢@Anita,因为这也是对我有用的答案.

Thanks @Anita, as this was the answer that worked for me too.

这篇关于找不到模块"ts-node/register"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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