简体   繁体   English

如何修复此意外令牌错误?

[英]How do I fix this Unexpected token error?

Getting an error and I don't know why.出现错误,我不知道为什么。 Any idea?任何想法?

Unexpected token / in JSON at position 233

I have found a few possible fixes and implemented them but they have not worked either.我找到了一些可能的修复程序并实施了它们,但它们也没有奏效。

This is the code:这是代码:

const v2_ABIs = require("./Uniswap_V2_ABIs.json");

const v2abi = JSON.parse(v2_ABIs);

v2abi = v2abi.trim();

console.log(v2abi);

I had a read through the comments.我阅读了评论。 If removing JSON.parse stopped causing the error.如果删除 JSON.parse 停止导致错误。 That means the JSON you where using contained something that caused a js exception when trying to parse it.这意味着您使用的 JSON 在尝试解析时包含导致 js 异常的内容。 If you can share the JSON I can pinpoint the exact issue, but if you don't actually need to parse it then its no problem.如果您可以共享 JSON,我可以查明确切的问题,但如果您实际上不需要解析它,那么它没问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM