量角器选项在package.json脚本中不起作用

问题描述 投票:0回答:1

以下命令按预期工作:

protractor --cucumberOpts.tags='not @tag1' conf.js

现在我想将这个命令作为script添加到package.json,如下所示:

"scripts": {
    "my-script": "protractor --cucumberOpts.tags='not @tag1' conf.js"
}

运行命令npm run my-script给出了以下错误:

Usage: protractor [configFile] [options]
configFile defaults to protractor.conf.js
The [options] object will override values from the config file.
See the reference config for a full list of options.

Options:
  ...

Error: Error: more than one config file specified

这是为什么?

这两个命令看起来都是一样的。

protractor package.json cucumberjs
1个回答
1
投票

这实际上不是量角器问题。我能够重新创建此问题并通过在该脚本字符串中使用转义的双引号来解决它。

"scripts": {
    "my-script": "protractor --cucumberOpts.tags=\"not @tag1\" conf.js"
}

这个问题(显然)与节点如何处理不同操作系统上的单引号有关。在this问题中有更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.