大家好,我使用
node install -g chai
安装了chai ,我使用
npm -g list |grep chai
可以看到chai@3.0.0,接下来我在我的test.js中使用,
var chai=require('chai'); var expect=require('chai').expect; describe('services',function(){
describe('#demo',function(){ it('services should return a string',function(done){ expect('hello').to.a('string'); done(); }); });});
结果我得到了一个错误,
Cannot find module 'chai'
这是怎么回事呢?
回复 (2)
J
-g安装一般是安装全局的binary
W
不能在项目中直接加载全局的第三方模块.建议装在项目中,无须依赖全局环境.
npm install chai --save-dev
参与回复
登录后即可参与回复。登录