2

执行 mocha npm test 时出现以下问题

'make' 不是内部或外部命令、可运行程序或批处理文件。npm 错误!奇怪的错误 1 ​​npm ERR!不好的代码 0

makefile:
 test:
   ./node_modules/.bin/mocha \
     --reporter list

 .PHONY: test

package.json

{
  "name": "application-name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app.js",
    "test": "make test"
  },
  "dependencies": {
    "express": "3.3.4",
    "jade": "*",
    "mongoose": ">= 2.6.5",
    "nodemailer": "0.3.20",
    "connect": ">= 1.9.1",
    "socket.io": "~0.9",
    "cookie": "0.0.4",
    "kue" : "*",
    "async" : "*",
    "mocha": "*",
    "should" : "*",
    "winston" : "*"
  }
}
4

1 回答 1

5

您可能没有安装 make 。你在 Windows 上吗?

但是,您不需要也不应该使用 make 来运行测试。相反,在 package.json 的底部添加以下内容:

  "scripts": {
    "test": "mocha -R list",
  }

现在,您只需输入npm test.

于 2013-09-17T17:10:28.473 回答