解决“微信开发者工具导入wepy-cli生成的项目后控制台报错显示app.json: app.json 未找到”的问题
微信小程序开发者工具版本:
导入之前
项目根目录下的project.config.json
文件:
{
"description": "A WePY project",
"setting": {
"urlCheck": true,
"es6": false,
"postcss": false,
"minified": false
},
"compileType": "miniprogram",
"appid": " wx4e367dd65dd063b6",
"projectname": "heima_ugou",
"miniprogramRoot": "./dist"
}
导入之后
项目根目录下的project.config.json
文件被修改为:
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": true,
"es6": true,
"enhance": false,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useApiHook": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": []
},
"compileType": "miniprogram",
"libVersion": "2.13.1",
"appid": "wx4e367dd65dd063b6",
"projectname": "heima_ugou",
"miniprogramRoot": "./dist",
"debugOptions": {
"hidedInDevtools": []
},
"scripts": { },
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": { },
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"current": -1,
"list": []
},
"plugin": {
"current": -1,
"list": []
},
"gamePlugin": {
"current": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}
问题原因:
导入项目后project.config.json
文件被微信开发者工具修改,缺少代码:"miniprogramRoot": "./dist"
从而导致微信开发者工具无法找到app.json文件进而报错:app.json: app.json 未找到
解决办法:
向project.config.json
文件中添加如下代码后从新编译即可:
"miniprogramRoot": "./dist"