项目运行在浏览器上的时候就报这个错误,我把最近修改的东西都删掉了,但是还是报错,项目运行在android手机上是没有问题的
18:47:28.755 项目 'hello' 开始编译... 18:48:00.625 INFO Starting development server... 18:49:06.262 Module build failed (from ./node_modules/@dcloudio/webpack-uni-pages-loader/lib/index.js): 18:49:06.274 SyntaxError: Unexpected token , in JSON at position 6507 18:49:06.275 at JSON.parse (<anonymous>) 18:49:06.285 at parseJson (C:\Users\HP\Downloads\HBuilderX.1.8.2.20190401.full\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\uni-cli-shared\lib\json.js:17:20) 18:49:06.285 at parsePagesJson (C:\Users\HP\Downloads\HBuilderX.1.8.2.20190401.full\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\uni-cli-shared\lib\pages.js:27:27) 18:49:06.295 at Object.module.exports (C:\Users\HP\Downloads\HBuilderX.1.8.2.20190401.full\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\webpack-uni-pages-loader\lib\index.js:33:21)
有没有大神知道啊
1***@qq.com
- 发布:2019-04-18 18:55
- 更新:2019-04-19 09:14
- 阅读:2799
项目运行报错
分类:uni-app
1 个回复
1***@qq.com (作者)
已解决,希望可以给大家做个参考:
// #ifdef APP-PLUS
{
"path": "pages/template/nav-image/nav-image",
"style": {
"app-plus": {
"titleNView": {
"titleText": "",
"tags": [{
"tag": "img",
"src": "/static/nav.png",
"position": {
"left": "auto",
"top": "auto",
"width": "110px",
"height": "26px"
}
}]
}
}
}
}
// #endif
, {
"path" : "pages/template/nav-city-dropdown/nav-city-dropdown",
"style": {
"navigationBarTitleText": "导航栏带城市选择",
"app-plus": {
"titleNView": {
"buttons": [{
"text": "北京市",
"fontSize": "14",
"select": true,
"width": "auto"
}]
}
}
}
}
以上是错误的写法,在endif之后有个逗号,实际上是json格式的问题,希望大家以后写的时候一定注意json格式,下面是正确的写法
// #ifdef APP-PLUS
{
"path": "pages/template/nav-image/nav-image",
"style": {
"app-plus": {
"titleNView": {
"titleText": "",
"tags": [{
"tag": "img",
"src": "/static/nav.png",
"position": {
"left": "auto",
"top": "auto",
"width": "110px",
"height": "26px"
}
}]
}
}
}
},
// #endif
{
"path" : "pages/template/nav-city-dropdown/nav-city-dropdown",
"style": {
"navigationBarTitleText": "导航栏带城市选择",
"app-plus": {
"titleNView": {
"buttons": [{
"text": "北京市",
"fontSize": "14",
"select": true,
"width": "auto"
}]
}
}
}
}