• notice
  • Congratulations on the launch of the Sought Tech site

SvelteKit: "Error: request.query has been replaced by request.url.searchParams"

I want to try out SvelteKit on MacOs 11.5.2.Use node v16.13.1, npm 8.1.2.

I have installed SvelteKit following the original guide:

npm init svelte@next my-app
cd my-app
npm install
npm run dev----open

Then, when localhost:3000 opens, I get this error: font>

**Error: request.query has been replaced by request.url.searchParams**
    at Object.get (file:///Web/Svelte_30-12-21/my-app/node_modules/@sveltejs/kit/dist/ssr.js:1753:12)
    at Object.handle (/Web/Svelte_30-12-21/my-app/src/hooks.ts:10:30)
    at respond (file:///Web/Svelte_30-12-21/my-app/node_modules/@sveltejs/kit/dist/ssr.js:1764:30)
    at svelteKitMiddleware (file:///Web/Svelte_30-12-21/my-app/node_modules/@sveltejs/kit/dist/chunks/index.js:4577:28)

What could be the problem?

uj5u.com enthusiastic netizens replied:

This issue was introduced in a commit made earlier today andReport.It has been fixed, run npm updateor wash your node_modules directory and reinstall.

uj5u.com enthusiastic netizens replied:

I had the same problem.in src/hooks.jsreplace

const method=request.query.get('_method');

and

const method=request.method;

If you are usingnpm init svelte@next my-appDemo app, you will also be in Header.svelte.

instead of

<li class:active={$page.path==='/'}><a sveltekit:prefetch href="/">Home </a></li>
<li class:active={$page.path==='/about'}><a sveltekit:prefetch href="/about">About</a></li> 
<li class:active={$page.path==='/todos'}><a sveltekit:prefetch href="/todos">Todos</a></li> 

and

<ul>
  <li class:active={$page.url.pathname==='/' }><a sveltekit:prefetch href="/">Home</a></li> 
  <li class:active={$page.url.pathname==='/about '}>
   <a sveltekit:prefetch href="/about">About </a>
  </li>
  <li class:active={$page.url.pathname==='/todos '}>
    <a sveltekit:prefetch href="/todos">Todos </a>
  </li>
</ul>

Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+