gpt4 book ai didi

cucumber - 试图运行 cucumber 但出现此错误

转载 作者:行者123 更新时间:2023-12-02 02:57:27 31 4
gpt4 key购买 nike

我正在尝试使用 javascript 运行一些 cucumber 测试,但我一直收到此错误。如果是,我是否需要更改我的执行路径,我该怎么做?我尝试在本地和全局安装 cucumber ,但似乎没有得到解决

cucumber-js
Error:
You appear to be executing an install of cucumber (most likely a global install)
that is different from your local install (the one required in your support files).
For cucumber to work, you need to execute the same install that is required in your support files.
Please execute the locally installed version to run your tests.

Executed Path: /usr/local/lib/node_modules/cucumber/lib/index.js
Local Path: /Users/chiragverma/node_modules/cucumber/lib/index.js

at /usr/local/lib/node_modules/cucumber/lib/cli/install_validator.js:22:13
at Generator.next (<anonymous>)
at Generator.tryCatcher (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/generators.js:97:49)
at Promise._settlePromise (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/promise.js:574:26)
at Promise._settlePromise0 (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
Chirags-MacBook-Air:test chiragverma$ sudo cp /Users/chiragverma/ /usr/local/lib/
Password:
Sorry, try again.
Password:
cp: /Users/chiragverma/ is a directory (not copied).
Chirags-MacBook-Air:test chiragverma$ cucumber-js
Error:
You appear to be executing an install of cucumber (most likely a global install)
that is different from your local install (the one required in your support files).
For cucumber to work, you need to execute the same install that is required in your support files.
Please execute the locally installed version to run your tests.

Executed Path: /usr/local/lib/node_modules/cucumber/lib/index.js
Local Path: /Users/chiragverma/node_modules/cucumber/lib/index.js

at /usr/local/lib/node_modules/cucumber/lib/cli/install_validator.js:22:13
at Generator.next (<anonymous>)
at Generator.tryCatcher (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/generators.js:97:49)
at Promise._settlePromise (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/promise.js:574:26)
at Promise._settlePromise0 (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/usr/local/lib/node_modules/cucumber/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
Chirags-MacBook-Air:test chiragverma$ sudo cp /Users/chiragverma /usr/local/lib
cp: /Users/chiragverma is a directory (not copied).

最佳答案

您需要在 .vscode/launch.json 中指定 cwd,如下所示:

"cwd": "${workspaceRoot}"

整个就像,

"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"stopOnEntry": false,
"args": [
"${workspaceRoot}/config/config.js"
],
}
]

我有一个类似的问题,我得到的解决方案from github forum

关于cucumber - 试图运行 cucumber 但出现此错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48510826/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com