文件:////home/user/.npm/_npx/1415fee72ff6294b/node_modules/create-vite/dist/index.mjs:48`),this.close()}_(t,s){return t.toLowerCase()===\'y\'?(this.value=!0,this.submit():t.toLowerCase()==...
file:///home/user/.npm/_npx/1415fee72ff6294b/node_modules/create-vite/dist/index.mjs:48
`),this.close()}_(t,s){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Ie.hide):this.out.write(Fr(this.outputText,this.out.columns)),super.render(),this.outputText=[_e.symbol(this.done,this.aborted),De.bold(this.msg),_e.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:De.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Lr.line+Ie.to(0)+this.outputText))}}var Hr=kr,Yr={TextPrompt:di,SelectPrompt:bi,TogglePrompt:Si,DatePrompt:ur,NumberPrompt:br,MultiselectPrompt:Ee,AutocompletePrompt:_r,AutocompleteMultiselectPrompt:jr,ConfirmPrompt:Hr};(function(e){const t=e,s=Yr,i=r=>r;function n(r,l,d={}){return new Promise((a,b)=>{const p=new s[r](l),h=d.onAbort||i,c=d.onSubmit||i,g=d.onExit||i;p.on("state",l.onState||i),p.on("submit",x=>a(c(x))),p.on("exit",x=>a(g(x))),p.on("abort",x=>b(h(x)))})}t.text=r=>n("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>n("NumberPrompt",r),t.date=r=>n("DatePrompt",r),t.confirm=r=>n("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return n("TextPrompt",r,{onSubmit:d=>d.split(l).map(a=>a.trim())})},t.toggle=r=>n("TogglePrompt",r),t.select=r=>n("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=d=>d.filter(a=>a.selected).map(a=>a.value);return n("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=d=>d.filter(a=>a.selected).map(a=>a.value);return n("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const o=(r,l)=>Promise.resolve(l.filter(d=>d.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||o,r.choices=[].concat(r.choices||[]),n("AutocompletePrompt",r))})(oe);const Ft=oe,Vr=["suggest","format","onState","validate","onRender","type"],Re=()=>{};async function V(e=[],{onSubmit:t=Re,onCancel:s=Re}={}){const i={},n=V._override||{};e=[].concat(e);let o,r,l,d,a,b;const p=async(h,c,g=!1)=>{if(!(!g&&h.validate&&h.validate(c)!==!0))return h.format?await h.format(c,i):c};for(r of e)if({name:d,type:a}=r,typeof a=="function"&&(a=await a(o,{...i},r),r.type=a),!!a){for(let h in r){if(Vr.includes(h))continue;let c=r[h];r[h]=typeof c=="function"?await c(o,{...i},b):c}if(b=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:d,type:a}=r,Ft[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(n[r.name]!==void 0&&(o=await p(r,n[r.name]),o!==void 0)){i[d]=o;continue}try{o=V._injected?Br(V._injected,r.initial):await Ft[a](r),i[d]=o=await p(r,o,!0),l=await t(r,o,i)}catch{l=!await s(r,i)}if(l)return i}return i}function Br(e,t){const s=e.shift();if(s instanceof Error)throw s;return s===void 0?t:s}function Gr(e){V._injected=(V._injected||[]).concat(e)}function Jr(e){V._override=Object.assign({},e)}var Wr=Object.assign(V,{prompt:V,prompts:Ft,inject:Gr,override:Jr});const Ae=pt(Wr);let W=!0;const X=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let it=0;if(X.process&&X.process.env&&X.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:s,TERM:i,COLORTERM:n}=X.process.env;t||s||e==="0"?W=!1:e==="1"||e==="2"||e==="3"?W=!0:i==="dumb"?W=!1:"CI"in X.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in X.process.env)?W=!0:W=process.stdout.isTTY,W&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?it=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?it=2:it=1)}let je={enabled:W,supportLevel:it};function A(e,t,s=1){const i=`\x1B[${e}m`,n=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>je.enabled&&je.supportLevel>=s?i+(""+r).replace(o,i)+n:""+r}const B=A(0,0),ct=A(31,39),Ne=A(32,39),j=A(33,39),k=A(34,39),zr=A(35,39),Fe=A(36,39),Ur=A(91,39),qr=A(92,39),Lt=A(94,39),ut=_s(process.argv.slice(2),{string:["_"]}),kt=process.cwd(),Ht=[{name:"vanilla",display:"Vanilla",color:j,variants:[{name:"vanilla-ts",display:"TypeScript",color:k},{name:"vanilla",display:"JavaScript",color:j}]},{name:"vue",display:"Vue",color:Ne,variants:[{name:"vue-ts",display:"TypeScript",color:k},{name:"vue",display:"JavaScript",color:j},{name:"custom-create-vue",display:"Customize with create-vue \u2197",color:Ne,customCommand:"npm create vue@latest TARGET_DIR"},{name:"custom-nuxt",display:"Nuxt \u2197",color:qr,customCommand:"npm exec nuxi init TARGET_DIR"}]},{name:"react",display:"React",color:Fe,variants:[{name:"react-ts",display:"TypeScript",color:k},{name:"react-swc-ts",display:"TypeScript + SWC",color:k},{name:"react",display:"JavaScript",color:j},{name:"react-swc",display:"JavaScript + SWC",color:j},{name:"custom-remix",display:"Remix \u2197",color:Fe,customCommand:"npm create remix@latest TARGET_DIR"}]},{name:"preact",display:"Preact",color:zr,variants:[{name:"preact-ts",display:"TypeScript",color:k},{name:"preact",display:"JavaScript",color:j}]},{name:"lit",display:"Lit",color:Ur,variants:[{name:"lit-ts",display:"TypeScript",color:k},{name:"lit",display:"JavaScript",color:j}]},{name:"svelte",display:"Svelte",color:ct,variants:[{name:"svelte-ts",display:"TypeScript",color:k},{name:"svelte",display:"JavaScript",color:j},{name:"custom-svelte-kit",display:"SvelteKit \u2197",color:ct,customCommand:"npm create svelte@latest TARGET_DIR"}]},{name:"solid",display:"Solid",color:k,variants:[{name:"solid-ts",display:"TypeScript",color:k},{name:"solid",display:"JavaScript",color:j}]},{name:"qwik",display:"Qwik",color:Lt,variants:[{name:"qwik-ts",display:"TypeScript",color:Lt},{name:"qwik",display:"JavaScript",color:j},{name:"custom-qwik-city",display:"QwikCity \u2197",color:Lt,customCommand:"npm create qwik@latest basic TARGET_DIR"}]},{name:"others",display:"Others",color:B,variants:[{name:"create-vite-extra",display:"create-vite-extra \u2197",color:B,customCommand:"npm create vite-extra@latest TARGET_DIR"},{name:"create-electron-vite",display:"create-electron-vite \u2197",color:B,customCommand:"npm create electron-vite@latest TARGET_DIR"}]}],Le=Ht.map(e=>e.variants&&e.variants.map(t=>t.name)||[e.name]).reduce((e,t)=>e.concat(t),[]),Kr={_gitignore:".gitignore"},Yt="vite-project";async function Zr(){const e=ke(ut._[0]),t=ut.template||ut.t;let s=e||Yt;const i=()=>s==="."?O.basename(O.resolve()):s;let n;Ae.override({overwrite:ut.overwrite});try{n=await Ae([{type:e?null:"text",name:"projectName",message:B("Project name:"),initial:Yt,onState:u=>{s=ke(u.value)||Yt}},{type:()=>!E.existsSync(s)||tn(s)?null:"select",name:"overwrite",message:()=>(s==="."?"Current directory":`Target directory "${s}"`)+" is not empty. Please choose how to proceed:",initial:0,choices:[{title:"Remove existing files and continue",value:"yes"},{title:"Cancel operation",value:"no"},{title:"Ignore files and continue",value:"ignore"}]},{type:(u,{overwrite:y})=>{if(y==="no")throw new Error(ct("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>Ye(i())?null:"text",name:"packageName",message:B("Package name:"),initial:()=>Xr(i()),validate:u=>Ye(u)||"Invalid package.json name"},{type:t&&Le.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!Le.includes(t)?B(`"${t}" isn't a valid template. Please choose from below: `):B("Select a framework:"),initial:0,choices:Ht.map(u=>{const y=u.color;return{title:y(u.display||u.name),value:u}})},{type:u=>u&&u.variants?"select":null,name:"variant",message:B("Select a variant:"),choices:u=>u.variants.map(y=>{const m=y.color;return{title:m(y.display||y.name),value:y.name}})}],{onCancel:()=>{throw new Error(ct("\u2716")+" Operation cancelled")}})}catch(u){console.log(u.message);return}const{framework:o,overwrite:r,packageName:l,variant:d}=n,a=O.join(kt,s);r==="yes"?en(a):E.existsSync(a)||E.mkdirSync(a,{recursive:!0});let b=d||o?.name||t,p=!1;b.includes("-swc")&&(p=!0,b=b.replace("-swc",""));const h=sn(process.env.npm_config_user_agent),c=h?h.name:"npm",g=c==="yarn"&&h?.version.startsWith("1."),{customCommand:x}=Ht.flatMap(u=>u.variants).find(u=>u.name===b)??{};if(x){const u=x.replace(/^npm create /,()=>c==="bun"?"bun x create-":`${c} create `).replace("@latest",()=>g?"":"@latest").replace(/^npm exec/,()=>c==="pnpm"?"pnpm dlx":c==="yarn"&&!g?"yarn dlx":c==="bun"?"bun x":"npm exec"),[y,...m]=u.split(" "),G=m.map(M=>M.replace("TARGET_DIR",s)),{status:C}=Ps.sync(y,G,{stdio:"inherit"});process.exit(C??0)}console.log(`
SyntaxError: Unexpected token '.'
at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
npm ERR! code 1
npm ERR! path /home/user/Desktop/Master ReactJS
npm ERR! command failed
npm ERR! command sh -c create-vite "my-project" "--template" "react"
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2024-05-03T06_00_32_505Z-debug-0.log
npm create vite@latest 我的项目 -- --template reactcd 我的项目