当前位置:  开发笔记 > 前端 > 正文

运行npm install时的mocha&chai依赖项

如何解决《运行npminstall时的mocha&chai依赖项》经验,为你挑选了1个好方法。

我想用Grunt(Yeoman Ionic)运行一个Ionic应用程序.为此,脚本运行npm install并且bower install.然后运行grunt编译,然后grunt serve在本地主机上提供它.

npm install不会像Mocha和Chai那样创建对等依赖项,因为它会bower install像这样中止:

Running "karma:continuous" (karma) task
Warning: Cannot find module 'mocha' Use --force to continue.

Aborted due to warnings.

我跑了npm install -g chai mocha然后npm install也一样

 npm WARN karma-mocha@0.1.10 requires a peer of mocha@* but none was installed.
npm WARN karma-chai@0.1.0 requires a peer of chai@* but none was installed.

即使这是一个警告,它在运行时会产生错误yo ionic:

npm WARN karma-chai@0.1.0 requires a peer of chai@* but none was installed.
npm WARN karma-mocha@0.1.10 requires a peer of mocha@* but none was installed.
ERROR: Error: ENOENT: no such file or directory, rename '/Users/donjohnson/ionicNom/app/app/css' -> '/Users/donjohnson/ionicNom/app/app/styles'
ERROR: Error: ENOENT: no such file or directory, rename '/Users/donjohnson/ionicNom/app/app/js' -> '/Users/donjohnson/ionicNom/app/app/scripts'
ERROR: Error: ENOENT: no such file or directory, rename '/Users/donjohnson/ionicNom/app/app/img' -> '/Users/donjohnson/ionicNom/app/app/images'

这使得grunt服务打开一个浏览器页面,里面没有任何东西:(



1> thebearinged..:

npm install --save-dev mocha chai到你的项目(没有-g).

从版本3开始,npm不会自动安装peerDependencies

推荐阅读
wangtao
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有