[试图在炮兵中运行RampTo函数时,出现以下错误。
config:
target: 'https://reqres.in'
phases:
- duration: 120
arrivalRate: 10
rampTo: 20
scenarios:
- flow:
- post:
url: "/api/users"
json:
id1: "Harley"
job: "Software Engineer"
如果(!script.config.target &&!options.environment){
TypeError:无法读取null的属性'target'在checkConfig(/home/scrapbook/tutorial/node_modules/artillery/lib/util.js:151:21)在fn(/home/scrapbook/tutorial/node_modules/async/lib/async.js:746:34)在/home/scrapbook/tutorial/node_modules/async/lib/async.js:1213:16在/home/scrapbook/tutorial/node_modules/async/lib/async.js:166:37在/home/scrapbook/tutorial/node_modules/async/lib/async.js:706:43在/home/scrapbook/tutorial/node_modules/async/lib/async.js:167:37立即。 (/home/scrapbook/tutorial/node_modules/async/lib/async.js:1206:34)在runCallback(timers.js:672:20)在tryOnImmediate(timers.js:645:5)在processImmediate [as _immediateCallback](timers.js:617:5)
我知道已经很长时间了,但是今天我得到了这个错误,只是解决它。
在我的情况下只是indent
,但在您的情况下,必须将target
值单引号'
更改为双引号"
,如下所示:
config:
target: "https://reqres.in"
phases:
duration: 120
arrivalRate: 10
rampTo: 20
scenarios:
flow:
- post:
url: "/api/users"
json:
id1: "Harley"
job: "Software Engineer"
我也固定了缩进,yaml
文件中总是缩进是问题。问候