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

Error with fresh sveltekit app #5495

Closed
junreyb opened this issue Jul 13, 2022 · 4 comments · Fixed by #5498 or sveltinio/sveltin#54
Closed

Error with fresh sveltekit app #5495

junreyb opened this issue Jul 13, 2022 · 4 comments · Fixed by #5498 or sveltinio/sveltin#54

Comments

@junreyb
Copy link

junreyb commented Jul 13, 2022

Describe the bug

Just created a new sveltekit app and it's throwing an error right after running npm run dev:

Function called outside component initialization
Error: Function called outside component initialization

Reproduction

  • npm create svelte my-app
  • cd my-app
  • npm install
  • npm run dev -- --open

Logs

Function called outside component initialization
Error: Function called outside component initialization
    at get_current_component (/node_modules/svelte/internal/index.mjs:953:15)
    at Module.setContext (/node_modules/svelte/internal/index.mjs:985:5)
    at root.svelte:14:1
    at $$render (/node_modules/svelte/internal/index.mjs?v=70fc108d:1770:22)
    at Object.render (/node_modules/svelte/internal/index.mjs?v=70fc108d:1778:26)
    at render_response (file:///Users/jbeduya/code/playground/sveltekit/my-app/.svelte-kit/runtime/server/index.js:1383:27)
    at async respond$1 (file:///Users/jbeduya/code/playground/sveltekit/my-app/.svelte-kit/runtime/server/index.js:2996:4)
    at async resolve (file:///Users/jbeduya/code/playground/sveltekit/my-app/.svelte-kit/runtime/server/index.js:3346:11)
    at async respond (file:///Users/jbeduya/code/playground/sveltekit/my-app/.svelte-kit/runtime/server/index.js:3290:20)
    at async file:///Users/jbeduya/code/playground/sveltekit/my-app/node_modules/@sveltejs/kit/dist/vite.js:2324:22

Function called outside component initialization
Error: Function called outside component initialization
    at get_current_component (/node_modules/svelte/internal/index.mjs:953:15)
    at Module.setContext (/node_modules/svelte/internal/index.mjs:985:5)
    at root.svelte:14:1
    at $$render (/node_modules/svelte/internal/index.mjs?v=70fc108d:1770:22)
    at Object.render (/node_modules/svelte/internal/index.mjs?v=70fc108d:1778:26)
    at render_response (file:///Users/jbeduya/code/playground/sveltekit/my-app/.svelte-kit/runtime/server/index.js:1383:27)
    at async respond_with_error (file:///Users/jbeduya/code/playground/sveltekit/my-app/.svelte-kit/runtime/server/index.js:2758:10)
    at async respond$1 (file:///Users/jbeduya/code/playground/sveltekit/my-app/.svelte-kit/runtime/server/index.js:3013:4)
    at async resolve (file:///Users/jbeduya/code/playground/sveltekit/my-app/.svelte-kit/runtime/server/index.js:3346:11)
    at async respond (file:///Users/jbeduya/code/playground/sveltekit/my-app/.svelte-kit/runtime/server/index.js:3290:20)

System Info

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
    Memory: 84.08 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.1 - ~/.volta/tools/image/node/16.15.1/bin/node
    Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
    npm: 8.11.0 - ~/.volta/tools/image/node/16.15.1/bin/npm
  Browsers:
    Brave Browser: 96.1.32.106
    Chrome: 103.0.5060.114
    Firefox: 98.0.1
    Safari: 15.5
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.57 
    @sveltejs/kit: next => 1.0.0-next.370 
    svelte: ^3.44.0 => 3.49.0 
    vite: ^2.9.13 => 2.9.14

Severity

blocking all usage of SvelteKit

Additional Information

No response

@graywolf336
Copy link

I confirmed the issue here on my side as well. I tried both a new project and a new demo, both failed to run dev with the same error. However, I could do npm run build and npm run preview just fine and both worked without any errors.

@Rich-Harris
Copy link
Member

gonna keep this open until we've confirmed that it's fixed...

@Rich-Harris Rich-Harris reopened this Jul 13, 2022
@graywolf336
Copy link

I can confirm, bumping "@sveltejs/kit" to the latest version just released fixes the issue. Thank you for the quick work!

@Conduitry
Copy link
Member

Yup, looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants