I have an error with my jsconfig.json in react js says throw err Unexpected token } in JSON at position
Asked Answered
G

1

5

The problem is that when i try to run yarn start then says the error

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 ? here my code

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

so i leave here somes prints to be more clear

the error print

and here my code print enter image description here

Greengage answered 7/1, 2021 at 4:12 Comment(0)
P
6

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"

"moduleResolution": "node",
"baseUrl": "./node_modules",
"paths": {
  "*": [
    "../types/*",
    "./@types/*",
    "./*"
  ]
}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
Perez answered 7/1, 2021 at 6:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.