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

bug: bunx JSON Parse error: Unrecognized token 'ߋ' #1559

Closed
patbhakta opened this issue Sep 10, 2023 · 4 comments
Closed

bug: bunx JSON Parse error: Unrecognized token 'ߋ' #1559

patbhakta opened this issue Sep 10, 2023 · 4 comments
Labels
🐞 upstream bug Blocked by a bug upstream

Comments

@patbhakta
Copy link

patbhakta commented Sep 10, 2023

Provide environment information

System:
OS: Windows 10 10.0.22621
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K
Memory: 44.72 GB / 63.75 GB
Binaries:
Node: 18.16.1 - C:\Program Files\nodejs\node.EXE
npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64
bun version : 1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

Describe the bug

52 | `),I.emptyDirSync(t))}s.start(),I.copySync(n,t),I.renameSync($.join(t,"_gitignore"),$.join(t,".gitignore"));let r=e==="."?"App":w.cyan.bold(e);s.succeed(`${r} ${w.green("scaffolded successfully!")}
53 | `)};import b from"path";import ge from"fs-extra";var de=({projectDir:e,packages:t})=>{let i=b.join(m,"template/extras/src/pages/_app"),o=t.trpc.inUse,n=t.nextAuth.inUse,s="";if(n&&o?s="with-auth-trpc.tsx":n&&!o?s="with-auth.tsx":!n&&o&&(s="with-trpc.tsx"),s!==""){let r=b.join(i,s),l=b.join(e,"src/pages/_app.tsx");ge.copySync(r,l)}},ue=({projectDir:e,packages:t})=>{let i=b.join(m,"template/extras/src/pages/index"),o=t.trpc.inUse,n=t.tailwind.inUse,s=t.nextAuth.inUse,r="";if(o&&n&&s?r="with-auth-trpc-tw.tsx":o&&!n&&s?r="with-auth-trpc.tsx":o&&n?r="with-trpc-tw.tsx":o&&!n?r="with-trpc.tsx":!o&&n&&(r="with-tw.tsx"),r!==""){let l=b.join(i,r),p=b.join(e,"src/pages/index.tsx");ge.copySync(l,p)}};var he=async({projectName:e,packages:t,noInstall:i})=>{let o=d(),n=tt.resolve(process.cwd(),e);return await fe({projectName:e,projectDir:n,pkgManager:o,noInstall:i}),ce({projectDir:n,pkgManager:o,packages:t,noInstall:i}),de({projectDir:n,packages:t}),ue({projectDir:n,packages:t}),n};import{execSync as J}from"child_process";import W from"path";import A from"chalk";import{execa as C}from"execa";import we from"fs-extra";import ye from"inquirer";import nt from"ora";var it=e=>{try{return J("git --version",{cwd:e}),!0}catch{return!1}},F=e=>we.existsSync(W.join(e,".git")),V=async e=>{try{return await C("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}},ot=()=>{let t=J("git --version").toString().trim().split(" ")[2],i=t?.split(".")[0],o=t?.split(".")[1];return{major:Number(i),minor:Number(o)}},st=()=>J("git config --global init.defaultBranch || echo main").toString().trim(),xe=async e=>{if(a.info("Initializing Git..."),!it(e)){a.warn("Git is not installed. Skipping Git initialization.");return}let t=nt(`Creating a new git repo...
54 | `).start(),i=F(e),o=await V(e),n=W.parse(e).name;if(o&&i){t.stop();let{overwriteGit:s}=await ye.prompt({name:"overwriteGit",type:"confirm",message:`${A.redBright.bold("Warning:")} Git is already initialized in "${n}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,default:!1});if(!s){t.info("Skipping Git initialization.");return}we.removeSync(W.join(e,".git"))}else if(o&&!i){t.stop();let{initializeChildGitRepo:s}=await ye.prompt({name:"initializeChildGitRepo",type:"confirm",message:`${A.redBright.bold("Warning:")} "${n}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,default:!1});if(!s){t.info("Skipping Git initialization.");return}}try{let s=st(),{major:r,minor:l}=ot();r<2||r==2&&l<28?(await C("git",["init"],{cwd:e}),await C("git",["symbolic-ref","HEAD",`refs/heads/${s}`],{cwd:e})):await C("git",["init",`--initial-branch=${s}`],{cwd:e}),await C("git",["add","."],{cwd:e}),t.succeed(`${A.green("Successfully initialized and staged")} ${A.green.bold("git")}
55 | `)}catch{t.fail(`${A.bold.red("Failed:")} could not initialize git. Update git to the latest version!
56 | `)}};var ve=async({projectName:e=j,packages:t,noInstall:i,projectDir:o})=>{let n=d();a.info("Next steps:"),e!=="."&&a.info(`  cd ${e}`),i&&(n==="yarn"?a.info(`  ${n}`):a.info(`  ${n} install`)),t?.prisma.inUse&&a.info(`  ${n==="npm"?"npx":n} prisma db push`),["npm","bun"].includes(n)?a.info(`  ${n} run dev`):a.info(`  ${n} dev`),!await V(o)&&!F(o)&&a.info("  git init"),a.info('  git commit -m "initial commit"')};import M from"fs";import at from"path";function be(e,t,i){M.readdirSync(e).forEach(n=>{let s=at.join(e,n);if(M.statSync(s).isDirectory())be(s,t,i);else{let l=M.readFileSync(s,"utf8").replace(new RegExp(t,"g"),i);M.writeFileSync(s,l,"utf8")}})}var ke=(e,t)=>{let i=t.replace(/\*/g,"").replace(/[^\/]$/,"$&/");be(e,"~/",i)};import _e from"path";var Pe=e=>{let i=R(e).split("/"),o=i[i.length-1];if(o==="."){let r=_e.resolve(process.cwd());o=_e.basename(r)}let n=i.findIndex(r=>r.startsWith("@"));i.findIndex(r=>r.startsWith("@"))!==-1&&(o=i.slice(n).join("/"));let s=i.filter(r=>!r.startsWith("@")).join("/");return[o,s]};import rt from"gradient-string";var lt={blue:"#add7ff",cyan:"#89ddff",green:"#5de4c7",magenta:"#fae4fc",red:"#d0679d",yellow:"#fffac2"},Se=()=>{let e=rt(Object.values(lt)),t=d();(t==="yarn"||t==="pnpm")&&console.log(""),console.log(e.multiline(H))};import pt from"chalk";import{execa as Ie}from"execa";import Ae from"ora";var L=async(e,t,i)=>{let{onDataHandle:o,args:n=["install"],stdout:s="pipe"}=i,r=Ae(`Running ${t} install...`).start(),l=Ie(t,n,{cwd:e,stdout:s});return await new Promise((p,c)=>{o&&l.stdout?.on("data",o(r)),l.on("error",u=>c(u)),l.on("close",()=>p())}),r},ct=async(e,t)=>{switch(e){case"npm":return await Ie(e,["install"],{cwd:t,stderr:"inherit"}),null;case"pnpm":return L(t,e,{onDataHandle:i=>o=>{let n=o.toString();n.includes("Progress")&&(i.text=n.includes("|")?n.split(" | ")[1]??"":n)}});case"yarn":return L(t,e,{onDataHandle:i=>o=>{i.text=o.toString()}});case"bun":return L(t,e,{stdout:"ignore"})}},Ce=async({projectDir:e})=>{a.info("Installing dependencies...");let t=d();(await ct(t,e)??Ae()).succeed(pt.green(`Successfully installed dependencies!
57 | `))};import{execSync as mt}from"child_process";import ft from"https";var je=e=>{let t=v();t.includes("beta")?(a.warn("  You are using a beta version of create-t3-app."),a.warn("  Please report any bugs you encounter.")):t.includes("next")?(a.warn("  You are running create-t3-app with the @next tag which is no longer maintained."),a.warn("  Please run the CLI with @latest instead.")):t!==e&&(a.warn("  You are using an outdated version of create-t3-app."),a.warn("  Your version:",t+".","Latest version in the npm registry:",e),a.warn("  Please run the CLI with @latest to get the latest updates.")),console.log("")};function gt(){return new Promise((e,t)=>{ft.get("https://registry.npmjs.org/-/package/create-t3-app/dist-tags",i=>{if(i.statusCode===200){let o="";i.on("data",n=>o+=n),i.on("end",()=>{e(JSON.parse(o).latest)})}else t()}).on("error",()=>{t()})})}var Te=()=>gt().catch(()=>{try{return mt("npm view create-t3-app version").toString().trim()}catch{return null}});var dt=async()=>{let e=await Te();Se(),e&&je(e);let{appName:t,packages:i,flags:{noGit:o,noInstall:n,importAlias:s}}=await le(),r=oe(i),[l,p]=Pe(t),c=await he({projectName:p,packages:r,importAlias:s,noInstall:n}),u=B.readJSONSync(D.join(c,"package.json"));u.name=l,u.ct3aMetadata={initVersion:v()},B.writeJSONSync(D.join(c,"package.json"),u,{spaces:2}),s!=="~/"&&ke(c,s),n||await Ce({projectDir:c}),B.renameSync(D.join(c,"_eslintrc.cjs"),D.join(c,".eslintrc.cjs")),o||await xe(c),await ve({projectName:p,packages:r,noInstall:n,projectDir:c}),process.exit(0)};dt().catch(e=>{a.error("Aborting installation..."),e instanceof Error?a.error(e):(a.error("An unknown error has occurred. Please open an issue on github with the below:"),console.log(e)),process.exit(1)});

SyntaxError: JSON Parse error: Unrecognized token 'ߋ'
at /tmp/create-t3-app@latest--bunx/node_modules/create-t3-app/dist/index.js:57:805
at endReadableNT (node:stream:2387:52)
at processTicksAndRejections (:1:2602)
error: "create-t3-app" exited with code 1 (SIGHUP)

Reproduction repo

can't use due to no bun templates

To reproduce

bunx create-t3-app@latest t3-test

Additional information

No response

@patbhakta patbhakta changed the title bug: JSON Parse error: Unrecognized token 'ߋ' bug: bunx JSON Parse error: Unrecognized token 'ߋ' Sep 10, 2023
@patbhakta
Copy link
Author

Node.js v18.16.1
pat@PAT-W11PC:/mnt/c/Users/pat/huible$ bunx create-t3-app@latest t3-test
file:///tmp/create-t3-app@latest--bunx/node_modules/create-t3-app/dist/index.js:6
,j="my-t3-app",G="create-t3-app";import T from"path";import U from"fs-extra";var Y=({projectDir:e,packages:t})=>{let i=t?.nextAuth.inUse,o=t?.prisma.inUse,n=We(!!i,!!o),s=i&&o?"with-auth-prisma.mjs":i?"with-auth.mjs":o?"with-prisma.mjs":"";if(s!==""){let p=T.join(m,"template/extras/src/env",s),c=T.join(e,"src/env.mjs");U.copySync(p,c)}let r=T.join(e,".env"),l=T.join(e,".env.example");U.writeFileSync(r,n,"utf-8"),U.writeFileSync(l,Je+n,"utf-8")},We=(e,t)=>{let i=
^

SyntaxError: Unexpected token '.'
at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
at async link (internal/modules/esm/module_job.js:42:21)
error: "create-t3-app" exited with code 1 (SIGHUP)

@juliusmarminge
Copy link
Member

Works fine for me:

CleanShot 2023-09-14 at 19 29 27@2x

@juliusmarminge juliusmarminge added the 🚫 cant reproduce The bug described could not be reproduced label Sep 14, 2023
@c-ehrlich
Copy link
Member

can't reproduce this either. could be just about anything - issues with bun on windows, issues with the local environment, etc. happy to take a look if there are more people who have this, or a known way to reproduce.

CleanShot 2023-09-16 at 17 13 11@2x

@Purukitto
Copy link

@patbhakta Since you are on windows a lot of things either don't work properly or are buggy with bun. Take a look at this, might help your case.

Quoting bun.sh

Bun provides a limited, experimental native build for Windows. At the moment, only the Bun runtime is supported.

bun <file>
bun run <file>

Everything else is the wild west for now.

@juliusmarminge juliusmarminge added 🐞 upstream bug Blocked by a bug upstream and removed 🐞❔ unconfirmed bug 🚫 cant reproduce The bug described could not be reproduced labels Oct 1, 2023
@juliusmarminge juliusmarminge closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 upstream bug Blocked by a bug upstream
Projects
None yet
Development

No branches or pull requests

4 participants