Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unexpected token / in JSON" #29

Closed
ehrencrona opened this issue Sep 24, 2021 · 2 comments
Closed

"Unexpected token / in JSON" #29

ehrencrona opened this issue Sep 24, 2021 · 2 comments
Labels
wontfix This will not be worked on

Comments

@ehrencrona
Copy link

When using the command on an empty SvelteKit project I always get "Could not read the JSON file".

SvelteKit version [email protected]

Steps to reproduce:

pnpm init svelte@next addjest

✔ Which Svelte app template? › SvelteKit demo app. // i've tried skeleton app too with the same result
✔ Use TypeScript? … Yes
✔ Add ESLint for code linting? … No
✔ Add Prettier for code formatting? … Yes

cd addjest/
pnpm i
npx apply rossyman/svelte-add-jest

[ info ]  Applying preset rossyman/svelte-add-jest.
[ question ]  Enable Jest DOM support? (Y/n) · false
[ question ]  Enable TypeScript support? (y/N) · true
[ question ]  Generate example test file? (Y/n) · true
[ question ]  Enable JSDOM environment by default? (Y/n) · false
[ info ]  Adding required dependencies
[ info ]  Initializing Jest config
[ info ]  Initializing Babel config
[ info ]  Modifying TypeScript config for project
[ error ]  Could not read the JSON file.
SyntaxError: Unexpected token / in JSON at position 128
    at JSON.parse (<anonymous>)
    at EditJsonHandler.getContent (.../node_modules/apply/dist/Handlers/EditJsonHandler.js:58:50)
    at EditJsonHandler.handle (.../node_modules/apply/dist/Handlers/EditJsonHandler.js:28:42)
    at PresetApplier.performActions (.../node_modules/apply/dist/Applier/PresetApplier.js:78:27)
@yogenpoonudurai
Copy link

When using the command on an empty SvelteKit project I always get "Could not read the JSON file".

SvelteKit version [email protected]

Steps to reproduce:

pnpm init svelte@next addjest

✔ Which Svelte app template? › SvelteKit demo app. // i've tried skeleton app too with the same result
✔ Use TypeScript? … Yes
✔ Add ESLint for code linting? … No
✔ Add Prettier for code formatting? … Yes

cd addjest/
pnpm i
npx apply rossyman/svelte-add-jest

[ info ]  Applying preset rossyman/svelte-add-jest.
[ question ]  Enable Jest DOM support? (Y/n) · false
[ question ]  Enable TypeScript support? (y/N) · true
[ question ]  Generate example test file? (Y/n) · true
[ question ]  Enable JSDOM environment by default? (Y/n) · false
[ info ]  Adding required dependencies
[ info ]  Initializing Jest config
[ info ]  Initializing Babel config
[ info ]  Modifying TypeScript config for project
[ error ]  Could not read the JSON file.
SyntaxError: Unexpected token / in JSON at position 128
    at JSON.parse (<anonymous>)
    at EditJsonHandler.getContent (.../node_modules/apply/dist/Handlers/EditJsonHandler.js:58:50)
    at EditJsonHandler.handle (.../node_modules/apply/dist/Handlers/EditJsonHandler.js:28:42)
    at PresetApplier.performActions (.../node_modules/apply/dist/Applier/PresetApplier.js:78:27)

I faced the similar error. Removed the comments in the tsconfig.json file and ran the script again. And then it worked.

@rossyman
Copy link
Owner

Hi @ehrencrona and @firacloudtech -- We outlined this nuance within our README. Due to a lack of support from Preset to parse JSON-C files, this is something we cannot fix directly within our adder. I'm going to close this issue and mark it as wont-fix.

README Screenshot

Screenshot 2021-11-27 at 21 55 02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants