javascript - 我的 jsconfig.json 在 react js 中有一个错误说 throw err Unexpected token } in JSON at position

标签 javascript json reactjs vscode-jsconfig

问题是当我尝试运行 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.
但是当我删除我的 jsconfig.json 然后所有运行都没有问题,然后我再次创建我的 jsconfig
在我的项目中并放置我的所有配置,然后我在任何文件中进行更改,当重新启动时自动说没有错误重新启动没有问题并运行我更改的所有内容但是如果我重新启动服务器再次显示错误,我不想总是这样做我做错了什么?这是我的代码
{ "compilerOptions": {
"baseUrl": "src",
"paths": {
  "~/*":["*"],
    } 
  } 
}
所以我留下一些打印品更清晰
the error print
在这里我的代码打印
enter image description here

最佳答案

我不知道这是否是 yow 的情况,但是尾随逗号可能会给您带来一些错误。删除 yow "paths"处的逗号。
另外,“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'. */

关于javascript - 我的 jsconfig.json 在 react js 中有一个错误说 throw err Unexpected token } in JSON at position,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65606514/

相关文章:

http ://mysite. com 与 http ://www. mysite.com 的 JavaScript 问题

javascript - 在 React 的模板文字中插入 html 标签

javascript - 使用 React,为什么 redux saga 不拦截 Action ?

javascript - CKeditor 内联工具栏下拉菜单上的按键事件

javascript - 使用书签时 li 元素垂直折叠

javascript - Node.js:解析 JSON 对象

PHP/MySQL/JSON - 遍历 JSON 响应的所有页面

javascript - projects.map 不是 jest-cli 的函数

javascript - Flex 到 JavaScript 库/API

javascript - 错误类型错误 : Cannot read property '0' of undefined | Angular 4