咕噜的Nodeunit找不到模块“点击”

所以,在本教程中 ,我决定添加一些unit testing到我的node.js应用程序。 我gruntfile似乎是好的,当我inputgrunt nodeunit我唯一的testing运行得很好,但之后,它崩溃与错误Fatal error: Cannot find module 'tap'

 $> grunt nodeunit Running "nodeunit:all" (nodeunit) task Testing db.test.js .OK Fatal error: Cannot find module 'tap' 

我对这个模块一无所知,但是在googliing之后,似乎是nodeunit需要的东西。 实际上,存在$MY_NODE_APP/node_modules/nodeunit/node_modules/tap ,当我在$MY_NODE_APP/node_modules/nodeunit启动节点并在交互式控制台中inputrequire('tap')时,的东西,给我一个印象,它的工作原理应该。

所以,显而易见的问题是:为什么我得到这个错误,我该如何解决?

Gruntfile:

 module.exports = function(grunt) { grunt.initConfig({ nodeunit: { all: ['./**/*.test.js'] } }); grunt.loadNpmTasks('grunt-contrib-nodeunit'); }; 

更新 :安装了我的项目,但它也没有帮助。

我就这个问题着手解决了我自己的问题。 我会发布我的决议,因为这可能对别人有帮助:

首先是相似之处:

我刚刚得到了我的Gulp脚本安装程序,并且在运行我的testing时遇到了这个错误:

 Fatal error: Cannot find module 'tap' 

哪个没有意义,因为我没有使用该库!

我如何解决:

发现我的path都是在我的gulpfile.js搞砸了。 因此,我试图unit testing我的node_modules文件夹中的所有模块!

这是新的path:

  paths: { mocha: [ '**/*.test.js', '!node_modules/**/*.js' ] } 

我的问题是,我无意中在node_modules目录中运行testing。 我的npm testmocha **/*.test.js ,当我改变它为mocha src/**/*.test.js突然消息消失。 有道理真的。

我解决了这个问题(好吧,这个问题 – 这不是最后一个)手动安装tap模块。