node_modules不被识别为内部或外部命令

时间:2018-02-16 09:40:55

标签: javascript node.js automated-tests appium

我正在尝试使用appium,jasmine和perfecto mobile编写测试自动化脚本。我使用我自己的配置Appium Javascript Example

从以下网址克隆的项目

问题是当我执行 npm test 命令时出现以下错误

  

node_modules不被识别为内部或外部命令

这是packages.json脚本的样子:

  {
  "name": "perfecto_appium_sample",
  "version": "1.0.0",
  "description": "The following sample shows how to Install an application and use WebDriverIO to automate and test it.<br/> It uses selendroid test application which can be downloaded from [here](https://github.com/PerfectoCode/AppsForSamples/tree/master/selendroid-test-app-0.17.0).",
  "main": "perfectoSpec.js",
  "scripts": {
    "test": "node_modules/webdriverio/bin/wdio wdio.conf.js",
    "start": "wdio wdio.conf.js"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "wdio": "^0.3.3",
    "wdio-jasmine-framework": "^0.2.19",
    "wdio-mocha-framework": "^0.5.12"
  },
  "dependencies": {
    "wd": "^1.5.0",
    "webdriverio": "^4.10.2"
  },
  "keywords": []
}

1 个答案:

答案 0 :(得分:4)

您需要正确提供相对路径:

"scripts": {
    "test": "node ./node_modules/webdriverio/bin/wdio wdio.conf.js",
    "start": "wdio wdio.conf.js"
  }