npm 运行 测试错误 Node.js
npm run test error Node.js
我正在使用 node.js 制作 API 并想测试一些文件。 npm init
运行 很好并正确安装了软件包,例如 mongoose
和 express
。但是,当我 运行 npm run test-watch
终端抛出以下错误:
[nodemon] 1.14.11
[nodemon] to restart at any time, enter rs
[nodemon] watching: *.*
[nodemon] starting 'npm test'
'npm' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...
以下是 package.json 文件的内容:
"scripts": {
"test": "mocha server/**/*.test.js",
"test-watch": "nodemon --exec 'npm test'"
}
节点路径添加到用户路径。 init
运行s 成功并安装了软件包。所以我想知道语法有没有错误
注意:如果你想检查任何代码,请告诉我
这是因为我使用的是 Windows OS,语法有错误:
"test-watch": "nodemon --exec 'npm test'"
上面的代码应该是下面的:
"test-watch": "nodemon --exec \"npm test\""
我正在使用 node.js 制作 API 并想测试一些文件。 npm init
运行 很好并正确安装了软件包,例如 mongoose
和 express
。但是,当我 运行 npm run test-watch
终端抛出以下错误:
[nodemon] 1.14.11
[nodemon] to restart at any time, enter rs
[nodemon] watching: *.*
[nodemon] starting 'npm test'
'npm' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...
以下是 package.json 文件的内容:
"scripts": {
"test": "mocha server/**/*.test.js",
"test-watch": "nodemon --exec 'npm test'"
}
节点路径添加到用户路径。 init
运行s 成功并安装了软件包。所以我想知道语法有没有错误
注意:如果你想检查任何代码,请告诉我
这是因为我使用的是 Windows OS,语法有错误:
"test-watch": "nodemon --exec 'npm test'"
上面的代码应该是下面的:
"test-watch": "nodemon --exec \"npm test\""