使用npm install在安装依赖项后运行命令

cou*_*011 7 node.js protractor

我有这样的package.json文件

{
  "name": "E2E",
  "version": "1.0.0",
  "description": "AngularJS E2E testing",
  "main": "conf.js",
  "scripts": {
    "postinstall": "node_modules/protractor/bin/webdriver-manager update",
    "test": "echo \"Error: no test specified\" && exit 1"
  },  
  "license": "ISC",
  "devDependencies": {
    "protractor": "^2.2.0"
  }
}
Run Code Online (Sandbox Code Playgroud)

npm install安装量角器后运行命令时抛出错误

node_modules/protractor/bin/webdriver-manager update
'node_modules' is not recognized as an internal or external command, operable program or batch file
Run Code Online (Sandbox Code Playgroud)

cou*_*011 10

好的找到了修复,我需要像这样运行它作为节点命令

"postinstall": "node node_modules/protractor/bin/webdriver-manager update",
Run Code Online (Sandbox Code Playgroud)


Pav*_*vlo 1

尝试在可执行文件的路径前面添加一个点,后跟一个斜杠:

 ./node_modules/protractor/bin/webdriver-manager update
Run Code Online (Sandbox Code Playgroud)