林同学
林同学
  • 发布:2023-09-21 15:44
  • 更新:2023-09-21 17:12
  • 阅读:228

字节小程序打包失败,无法解析JSON

分类:uni小程序sdk
{  
  "pages": [  
    //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages  

    // #ifdef MP-TOUTIAO  
    {  
      "path": "pages/recommend/index",  
      "style": {  
        "navigationBarTitleText": "首页",  
        "backgroundColorTop": "#f7eded",  
        "enablePullDownRefresh": false,  
        "disableScroll": true,  
        "navigationBarBackgroundColor": "#000000",  
        "navigationBarTextStyle": "#ffffff",  
        "backgroundColor": "#000000"  
      }  
    },  
    {  
      "path": "pages/homePage/index",  
      "style": {  
        "backgroundColorTop": "#f6f6f6",  
        "navigationBarTitleText": "剧场",  
        "disableScroll": true,  
        "enablePullDownRefresh": false  
      }  
    },  
    {  
      "path": "pages/myPage/index",  
      "style": {  
        "navigationBarTitleText": "我的",  
        "enablePullDownRefresh": false,  
        "backgroundColorTop": "#f7eded",  
        "disableScroll": true  
      }  
    },  
    {  
      "path": "pages/collectionPage/index",  
      "style": {  
        "navigationBarTitleText": "追剧",  
        "backgroundColorTop": "#f7eded",  
        "disableScroll": true  
      }  
    },  
    {  
      "path": "pages/playerDetail/index",  
      "style": {  
        "navigationBarTitleText": "",  
        "enablePullDownRefresh": false,  
        "disableScroll": true,  
        "navigationBarBackgroundColor": "#000000",  
        "navigationBarTextStyle": "#ffffff",  
        "backgroundColor": "#000000"  
      }  
    },  

    // #endif  
    // #ifndef MP-TOUTIAO  
    {  
      "path": "pages/recommend/index",  
      "style": {  
        "navigationBarTitleText": "首页",  
        "navigationStyle": "custom",  
        "backgroundColorTop": "#f7eded",  
        "navigationBarBackgroundColor": "#000000",  
        "navigationBarTextStyle": "#ffffff",  
        "backgroundColor": "#000000",  
        "enablePullDownRefresh": false,  
        "disableScroll": true  
      }  
    },  
    {  
      "path": "pages/homePage/index",  
      "style": {  
        "navigationBarTitleText": "剧场",  
        "disableScroll": true,  
        "enablePullDownRefresh": false,  
        "navigationStyle": "custom"  
      }  
    },  
    {  
      "path": "pages/myPage/index",  
      "style": {  
        "navigationBarTitleText": "我的",  
        "navigationStyle": "custom",  
        "enablePullDownRefresh": false,  
        "backgroundColorTop": "#f7eded",  
        "disableScroll": true  
      }  
    },  
    {  
      "path": "pages/collectionPage/index",  
      "style": {  
        "navigationBarTitleText": "追剧",  
        "navigationStyle": "custom",  
        "backgroundColorTop": "#f7eded",  
        "disableScroll": true  
      }  
    },  
    {  
      "path": "pages/playerDetail/index",  
      "style": {  
        "navigationBarTitleText": "",  
        "enablePullDownRefresh": false,  
        "disableScroll": true,  
        "backgroundColor": "#000000",  
        "navigationStyle": "custom"  
      }  
    }  
    // #endif  
  ],  

  "subPackages": [  
    {  
      "root": "packagesA",  
      "pages": [  
        // #ifdef MP-TOUTIAO  
        {  
          "path": "pages/consumeRecord/index",  
          "style": {  
            "navigationBarTitleText": "",  
            "navigationBarBackgroundColor": "#ffffff",  
            "disableScroll": true  
          }  
        },  
        {  
          "path": "pages/recentVisit/index",  
          "style": {  
            "navigationBarTitleText": "",  

            "disableScroll": true,  
            "navigationBarBackgroundColor": "#ffffff",  
            "enablePullDownRefresh": false  
          }  
        },  
        {  
          "path": "pages/hotListPage/index",  
          "style": {  
            "navigationBarTitleText": "",  

            "disableScroll": true,  
            "navigationBarBackgroundColor": "#ffffff",  
            "enablePullDownRefresh": false  
          }  
        },  
        {  
          "path": "pages/couponPage/index",  
          "style": {  
            "navigationBarTitleText": "",  
            "navigationBarBackgroundColor": "#ffffff",  
            "disableScroll": true,  
            "enablePullDownRefresh": false  
          }  
        },  
        {  
          "path": "pages/activityCenter/index",  
          "style": {  
            "navigationBarTitleText": "",  
            "navigationBarBackgroundColor": "#ffffff",  
            "disableScroll": true,  
            "enablePullDownRefresh": false  
          }  
        },  

        {  
          "path": "pages/obtainList/index",  
          "style": {  
            "navigationBarTitleText": "看剧得卡",  
            "navigationBarBackgroundColor": "#ffffff",  
            "disableScroll": true,  
            "enablePullDownRefresh": false  
          }  
        },  
        // #endif  
        // #ifndef MP-TOUTIAO  
        {  
          "path": "pages/consumeRecord/index",  
          "style": {  
            "navigationBarTitleText": "",  
            "navigationStyle": "custom",  
            "navigationBarBackgroundColor": "#ffffff",  
            "disableScroll": true  
          }  
        },  
        {  
          "path": "pages/recentVisit/index",  
          "style": {  
            "navigationBarTitleText": "",  
            "navigationStyle": "custom",  
            "disableScroll": true,  
            "navigationBarBackgroundColor": "#ffffff",  
            "enablePullDownRefresh": false  
          }  
        },  
        {  
          "path": "pages/hotListPage/index",  
          "style": {  
            "navigationBarTitleText": "",  
            "navigationStyle": "custom",  
            "disableScroll": true,  
            "navigationBarBackgroundColor": "#ffffff",  
            "enablePullDownRefresh": false  
          }  
        },  
        {  
          "path": "pages/couponPage/index",  
          "style": {  
            "navigationBarTitleText": "",  
            "navigationStyle": "custom",  
            "navigationBarBackgroundColor": "#ffffff",  
            "disableScroll": true,  
            "enablePullDownRefresh": false  
          }  
        },  
        {  
          "path": "pages/activityCenter/index",  
          "style": {  
            "navigationBarTitleText": "",  
            "navigationStyle": "custom",  
            "navigationBarBackgroundColor": "#ffffff",  
            "disableScroll": true,  
            "enablePullDownRefresh": false  
          }  
        },  

        {  
          "path": "pages/obtainList/index",  
          "style": {  
            "navigationBarTitleText": "看剧得卡",  
            "navigationStyle": "custom",  
            "navigationBarBackgroundColor": "#ffffff",  
            "disableScroll": true,  
            "enablePullDownRefresh": false  
          }  
        },  
        // #endif  
        {  
          "path": "pages/treaty/index",  
          "style": {  
            "navigationBarTitleText": "服务协议"  
          }  
        },  
        {  
          "path": "pages/webviewPage/index",  
          "style": {  
            "navigationBarTitleText": "",  
            "enablePullDownRefresh": false,  
            "navigationBarBackgroundColor": "#ffffff"  
          }  
        }  
      ]  
    }  
  ],  
  "globalStyle": {  
    "navigationBarTextStyle": "black",  
    "navigationBarTitleText": "uni-app",  
    "navigationBarBackgroundColor": "#F8F8F8",  
    "backgroundColor": "#F8F8F8"  
  },  
  "tabBar": {  
    "color": "#ffffff",  
    "selectedColor": "#ffffff",  
    "borderStyle": "black",  
    "backgroundColor": "#ffffff",  
    "custom": true,  
    "list": [  
      {  
        "pagePath": "pages/homePage/index",  
        "text": "首页"  
      },  
      {  
        "pagePath": "pages/recommend/index",  
        "text": "推荐"  
      },  
      {  
        "pagePath": "pages/collectionPage/index",  
        "text": "追剧"  
      },  
      {  
        "pagePath": "pages/myPage/index",  
        "text": "我的"  
      }  
    ]  
  }  
}  

使用cli脚手架打包到字节小程序报错,

Error: pages.json解析失败,不符合 json 规范  
Unexpected token ] in JSON at position 1474  
    at getJson (/Users/mac/Desktop/短剧客户端/my-project/node_modules/@dcloudio/uni-cli-shared/lib/json.js:35:11)  
    at getPagesJson (/Users/mac/Desktop/短剧客户端/my-project/node_modules/@dcloudio/uni-cli-shared/lib/pages.js:39:27)  
    at Object.<anonymous> (/Users/mac/Desktop/短剧客户端/my-project/node_modules/@dcloudio/vue-cli-plugin-uni/lib/env.js:206:22)  
    at Module._compile (node:internal/modules/cjs/loader:1105:14)  
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)  
    at Module.load (node:internal/modules/cjs/loader:981:32)  
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)  
    at Module.require (node:internal/modules/cjs/loader:1005:19)  
    at require (node:internal/modules/cjs/helpers:102:18)  
    at Object.<anonymous> (/Users/mac/Desktop/短剧客户端/my-project/node_modules/@dcloudio/vue-cli-plugin-uni/index.js:5:5)
2023-09-21 15:44 负责人:无 分享
已邀请:
林同学

林同学 (作者)

这是啥问题了?

DCloud_UNI_Anne

DCloud_UNI_Anne

应该是使用条件编译时 结合,位置不对

要回复问题请先登录注册