简体   繁体   English

我的 jsconfig.json 在反应 js 中出现错误,在 position 的 JSON 中说 throw err Unexpected token }

[英]I have an error with my jsconfig.json in react js says throw err Unexpected token } in JSON at position

The problem is that when i try to run yarn start then says the error问题是当我尝试运行 yarn start 然后说错误

yarn run v1.22.5$ react-app-rewired start
internal/modules/cjs/loader.js:1052
    throw err;
    ^

SyntaxError: /Users/dariocoronel/Desktop/practices/Gostack/javascript/repo/frontend/front/jsconfig.json: Unexpected token } in JSON at position 85
    at parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:1049:22)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at getModules (/Users/dariocoronel/Desktop/practices/Gostack/javascript/repo/frontend/front/node_modules/react-scripts/config/modules.js:126:14)
    at Object.<anonymous> (/Users/dariocoronel/Desktop/practices/Gostack/javascript/repo/frontend/front/node_modules/react-scripts/config/modules.js:142:18)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

but when i delete my jsconfig.json then all run without problem, then i create again my jsconfig inside my project and put all my configurations, and i make a change in anyfile and when restart automaticly says no error restar without problem and run all that i changed but if i restart the server says the error again, i don want to do this always what i doing wrong?但是当我删除我的 jsconfig.json 然后所有运行都没有问题时,然后我在我的项目中再次创建我的 jsconfig 并放置我所有的配置,我在任何文件中进行了更改,当重新启动时自动说没有错误重新启动没有问题并运行所有这些我改变了,但如果我重新启动服务器再次显示错误,我不想总是这样做我做错了什么? here my code这是我的代码

{ "compilerOptions": {
"baseUrl": "src",
"paths": {
  "~/*":["*"],
    } 
  } 
}

so i leave here somes prints to be more clear所以我把一些印刷品留在这里更清楚

错误打印

and here my code print在这里我的代码打印在此处输入图像描述

I do not know if it is yow case, but trailing commas can give you some errs.我不知道这是否是你的情况,但尾随逗号会给你一些错误。 remove the comma at yow "paths".删除您的“路径”处的逗号。

Also yow "baseUrl" should be "./node_modules"你的“baseUrl”也应该是“./node_modules”

"moduleResolution": "node",
"baseUrl": "./node_modules",
"paths": {
  "*": [
    "../types/*",
    "./@types/*",
    "./*"
  ]
}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */

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

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