Postman Newman:未知编码:在AWS CodeBuild上运行Newman cli时弹出latin1

Postman Newman:未知编码:在AWS CodeBuild上运行Newman cli时弹出latin1,postman,iso-8859-1,aws-codebuild,newman,Postman,Iso 8859 1,Aws Codebuild,Newman,几个月前,我在AWS CodeBuild上安装了Newman(postman cli),它工作得非常好。然后这个错误突然出现了:错误:未知编码:拉丁1 在本地工作中完美地运行相同的命令 在AWS EC2实例上的docker内部运行相同的命令可以完美地工作 它只在运行AWS代码构建时失败,AWS代码构建是我的AWS代码管道的一部分 JSON文件中没有任何特殊字符 这是我的代码构建规范 version: 0.2 env: variables: AWS_HOST : "https://

几个月前,我在AWS CodeBuild上安装了Newman(postman cli),它工作得非常好。然后这个错误突然出现了:
错误:未知编码:拉丁1

在本地工作中完美地运行相同的命令

在AWS EC2实例上的docker内部运行相同的命令可以完美地工作

它只在运行AWS代码构建时失败,AWS代码构建是我的AWS代码管道的一部分

JSON文件中没有任何特殊字符

这是我的代码构建规范

version: 0.2
env:
  variables:
      AWS_HOST : "https://api.aws.com/demo-testing"
phases:
  pre_build:
    commands:
      - npm install newman --global
  build:
    commands:
      - newman run APITesting.json -e env.json --bail
一切正常,除了
-newman run APITesting.json-e env.json

它给了我一个毫无意义的错误:
错误:未知编码:拉丁文1

即使我用demo.json替换了APITesting.json demo.json:

{
    "info": {
        "_postman_id": "5bc2766f-eefc-48f2-a778-f05b2b2465ef",
        "name": "A",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [
        {
            "name": "GetMyProfile",
            "event": [
                {
                    "listen": "test",
                    "script": {
                        "id": "1b46d302-7014-4c09-bac9-751d2cec959d",
                        "exec": [
                            "pm.test(\"Status code is 200\", function () {",
                            "    pm.response.to.have.status(200);",
                            "});"
                        ],
                        "type": "text/javascript"
                    }
                },
                {
                    "listen": "prerequest",
                    "script": {
                        "id": "f9a5dc64-33ab-42b1-9efa-f0a3614db340",
                        "exec": [
                            ""
                        ],
                        "type": "text/javascript"
                    }
                }
            ],
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "GET",
                "header": [
                    {
                        "key": "Content-Type",
                        "value": "application/json"
                    },
                    {
                        "key": "user",
                        "value": "xxxx"
                    },
                    {
                        "key": "email",
                        "value": "xxxx@gmail.com"
                    },
                ],
                "body": {
                    "mode": "raw",
                    "raw": ""
                },
                "url": {
                    "raw": "https://api.aws.com/demo-testing/api/profile",
                    "protocol": "https",
                    "host": [
                        "api",
                        "aws",
                        "com"
                    ],
                    "path": [
                        "demo-testing",
                        "api",
                        "profile"
                    ]
                }
            },
            "response": []
        }
    ]
}
它仍然在抱怨未知的编码。我尝试使用
file-I或file-I
获取文件的编码。所有文件都以
utf-8
us ascii编码

[Container] 2019/02/27 06:26:34 Running command file -i APITesting.json
APITesting.json: text/plain; charset=utf-8
[Container] 2019/02/27 06:26:34 Running command file -i env.json
env.json: text/plain; charset=us-ascii
[Container] 2019/02/27 06:26:34 Running command file -i demo.json
env.json: text/plain; charset=utf-8
一切都在Docker容器中运行,但我认为这无关紧要

我从Newman Github搜索了所有问题,但没有找到任何运气

我还搜索了所有与未知编码相关的内容:谷歌的latin1、StackOverflow和AWS论坛,但没有结果

我已经花了两天时间了。有人有线索吗

非常感谢你


Kun

如果有人遇到此问题,可以使用以下命令将UTF8更改为带BOM的UTF8:

sed-i'1s/^\xEF\xBB\xBF/'您的文件.json


这为我们解决了这个问题。

我对詹金斯也有同样的问题。如果找到解决方案,请提及我。Thanks@MustafaMohammadi是的,我找到了解决办法。因此,Newman有一个功能,您可以使用URL运行testingJSON文件。例如:
newman运行URL/APITesting.json
我希望它也能解决您的问题。