gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 15:08:49 25 4
gpt4 key购买 nike

问题是当我尝试运行 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com