有人能告诉我为什么Browserify可能不喜欢这段代码吗?
{
"months":[
{
"name":"January",
"value":0,
"days":31
},
{
"name":"February",
"value":1,
"days":28
},
{
"name":"March",
"value":2,
"days":31
},
{
"name":"April",
"value":3,
"days":30
},
{
"name":"May",
"value":4,
"days":31
},
{
"name":"June",
"value":5,
"days":30
},
{
"name":"July",
"value":6,
"days":31
},
{
"name":"August",
"value":7,
"days":31
},
{
"name":"September",
"value":8,
"days":30
},
{
"name":"October",
"value":9,
"days":31
},
{
"name":"November",
"value":10,
"days":30
},
{
"name":"December",
"value":11,
"days":31
}
],
"times":[
{
"name":"1200 AM",
"value":0
},
{
"name":"100 AM",
"value":1
},
{
"name":"200 AM",
"value":2
},
{
"name":"300 AM",
"value":3
},
{
"name":"400 AM",
"value":4
},
{
"name":"500 AM",
"value":5
},
{
"name":"600 AM",
"value":6
},
{
"name":"700 AM",
"value":7
},
{
"name":"800 AM",
"value":8
},
{
"name":"900 AM",
"value":9
},
{
"name":"1000 AM",
"value":10
},
{
"name":"1100 AM",
"value":11
},
{
"name":"1200 PM",
"value":12
},
{
"name":"100 PM",
"value":13
},
{
"name":"200 PM",
"value":14
},
{
"name":"300 PM",
"value":15
},
{
"name":"400 PM",
"value":16
},
{
"name":"500 PM",
"value":17
},
{
"name":"600 PM",
"value":18
},
{
"name":"700 PM",
"value":19
},
{
"name":"800 PM",
"value":20
},
{
"name":"900 PM",
"value":21
},
{
"name":"1000 PM",
"value":22
},
{
"name":"1100 PM",
"value":23
}
],
"years":[
2015,
2016,
2017,
2018,
2019,
2020,
2021,
2022,
2023,
2024,
2025
]
}
require
此文件时出现以下错误(文件名为dateTimes.json):
Error: Parse Error: Line 2: Unexpected token : in "/SkillfulCactus/client/scripts/data/dateTimes.js" while parsing file: /SkillfulCactus/client/scripts/data/dateTimes.js
我已经通过我能找到的任何验证器对文件进行了处理。我不知道为什么会抛出这个错误。
答案 0 :(得分:0)