【问题标题】:Installing local version of postman-to-k6 results in npm errors安装本地版本的 postman-to-k6 会导致 npm 错误
【发布时间】:2021-06-26 07:58:49
【问题描述】:

我的情况是,我正在尝试安装 postman-to-k6 以了解如何处理从 postman 到 K6 的转换。我尝试在我的 Ubuntu 机器和我的 mac 上安装该软件,但均未成功。

所以我的问题是我是否缺少安装 postman-to-k6 工具的基本步骤,在这种情况下,npm 包会出现什么问题或有什么问题?

我已尝试按照此处描述的流程进行操作:

https://k6.io/blog/load-testing-with-postman-collections

当我到达使用以下命令的步骤时npm install -g postman-to-k6 在终端中,这个输出显示在 Ubuntu 机器上:

martin.jonsson@unassigned:~$ npm install -g postman-to-k6
loadDep:xml2js → addNameR ▌ ╢██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine eslint@7.23.0: wanted: {"node":"^10.12.0 || >=12.0.0"} (current: {"nloadDep:xml2js → addNameR ▀ ╢██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine husky@4.3.8: wanted: {"node":">=10"} (current: {"node":"8.10.0","npmnpm WARN deprecated cheerio-select-tmp@0.1.1: Use cheerio-select instead
loadDep:v8-compile-cache  ▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine chalk@4.1.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","npmloadDep:v8-compile-cache  ▐ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine espree@7.3.1: wanted: {"node":"^10.12.0 || >=12.0.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine file-entry-cache@6.0.1: wanted: {"node":"^10.12.0 || >=12.0.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine table@6.0.9: wanted: {"node":">=10.0.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine @eslint/eslintrc@0.4.0: wanted: {"node":"^10.12.0 || >=12.0.0"} (curloadDep:v8-compile-cache  ▐ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine semver@7.3.5: wanted: {"node":">=10"} (current: {"node":"8.10.0","nploadDep:v8-compile-cache  ▄ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine eslint-visitor-keys@2.0.0: wanted: {"node":">=10"} (current: {"node"loadDep:eslint-visitor-ke ▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine flat-cache@3.0.4: wanted: {"node":"^10.12.0 || >=12.0.0"} (current: npm ERR! Linux 5.4.0-70-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "postman-to-k6"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/martin.jonsson/npm-debug.log

【问题讨论】:

    标签: ubuntu postman npm-install k6


    【解决方案1】:

    您正在运行一个非常旧版本的 NodeJS。日志试图告诉您需要运行 10.12.0 和 12.0.0 之间的版本:

    wanted: {"node":"^10.12.0 || &gt;=12.0.0"}

    虽然我无法在我的机器上重现该错误,但我绝对建议您先升级到更新版本的 NodeJS。

    【讨论】:

    • 感谢这帮助我走得更远,但似乎还有一些其他挑战。我现在似乎收到了这个错误:错误:EACCES:权限被拒绝,mkdir'/usr/local/lib/node_modules/postman-to-k6/vendor'
    • 我想我用这个解决方案解决了这个问题:您需要更改 node_modules 的所有权,因为您使用 sudo npm install -g "node-sass 所以它的所有权设置为 root,将所有权更改为当前用户作为组 - sudo chown -R root:YOUR_USERNAME /usr/local/lib/node_modules/ sudo chmod -R 775 /usr/local/lib/node_modules/ 如本 awnser 所述:stackoverflow.com/questions/49679808/…
    猜你喜欢
    • 2016-10-01
    • 2017-10-04
    • 2021-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-26
    • 2016-03-17
    相关资源
    最近更新 更多