NodeJS npm/cubble-.“"未被识别为内部或外部命令

aurhwmvo  于 2023-03-01  发布在  Node.js
关注(0)|答案(1)|浏览(115)

我安装了npm,显示版本为9.2.0。当我运行npm run test命令时,我得到错误'.' is not recognized as an internal or external command。我还检查了是否也设置了环境变量。我不知道为什么会发生这种情况。
下面是我的package.json文件:

{
  "name": "udemy_cucumber",
  "version": "1.0.0",
  "description": "practice bdd suite",
  "main": "index.js",
  "scripts": {
    "test": "./node_modules/.bin/cucumber-js --require cucumber.js --require step-definitions/**/*.js -f json:cucumber_report.json --publish-quiet"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@cucumber/cucumber": "^8.11.1",
    "@playwright/test": "^1.30.0",
    "chai": "^4.3.7",
    "cucumber-html-reporter": "^5.5.0",
    "i": "^0.3.7",
    "prettier": "^2.8.4"
  }
}

我的文件夹结构如下:

有人能帮我找出我错过了什么吗?

oug3syen

oug3syen1#

我自己发现的。显然,windows终端接受反斜杠来识别文件夹路径。
命令将为:

"test": ".\node_modules\.bin\cucumber-js --require cucumber.js --require step-definitions\**\*.js -f json:cucumber_report.json --publish-quiet"

相关问题