简体   繁体   English

无法在Windows(node.js)上运行gulp和karma

[英]Cannot run gulp and karma on windows (node.js)

I am making a MEAN course, and in one of the homeworks I have to work with gulp and karma for automated testing. 我正在上一门MEAN课程,在一项家庭作业中,我必须与gulp和karma一起进行自动化测试。

I am trying to run karma and gulp according to the instructions given in HMW 4.1 but I always have an error. 我试图按照HMW 4.1中给出的说明运行业力和吞咽,但我总是遇到错误。 Here are my steps: 这是我的步骤:

  1. Download and Extract the zip into a folder 下载zip并将其解压缩到文件夹中
  2. Change to the directory HMW4 (where the homework is) and run npm install 转到目录HMW4(作业所在的位置)并运行npm install
  3. Change the directory to node_modules\\gulp\\bin and run gulp watch 将目录更改为node_modules\\gulp\\bin并运行node_modules\\gulp\\bin gulp watch
  4. Windows open the JavaScript file instead of running. Windows将打开JavaScript文件而不是运行它。 Why? 为什么?

With Karma, I did something similar: 使用业力,我做了类似的事情:

  1. After trying to run gulp and failing, change to the directory node_modules/karma/bin 尝试运行node_modules/karma/bin并失败后,请转到目录node_modules/karma/bin
  2. Run karma start 运行karma start
  3. I get the following command like error 'karma' is not recognized as an internal or external command, operable program or batch file. 我收到以下命令,例如错误'karma' is not recognized as an internal or external command, operable program or batch file.

What am I missing or doing wrong ? 我想念什么或做错什么?

I installed Ubuntu LTS 14.04 in a VM using virtual box and indeed now everything seems to work perfectly. 我使用虚拟盒在VM中安装了Ubuntu LTS 14.04,实际上现在一切似乎都可以正常运行。 I would like to point out that running this code on Windows or in any other version of LInux is likely to bring problems, but in the specific Ubuntu version I previously mentioned, it works as intended. 我想指出的是,在Windows或LInux的任何其他版本上运行此代码可能会带来问题,但是在我前面提到的特定Ubuntu版本中,它可以按预期工作。

I shall now close this question, hopefully it will help others. 我现在结束这个问题,希望它将对其他人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM