Nikolas Blahušiak
Nikolas Blahušiak

Reputation: 636

SvelteKit dev server doesn't start

I want to try out the new SvelteKit replacement for Sapper, but I'm not able to start a dev server.

I ran:

npm init svelte@next
npm install
npm run dev -- --open

Error:

(node:16570) UnhandledPromiseRejectionWarning: .../Desktop/Programming/Web Development/Svelte/Demo-app/node_modules/@sveltejs/kit/dist/index4.js:262
        #map;
        ^

SyntaxError: Invalid or unexpected token
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (../Desktop/Programming/Web Development/Svelte/Demo-app/node_modules/@sveltejs/kit/dist/index.js:13:13)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
(node:16570) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:16570) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I haven't touched the generated code.

I know these kinds of errors pop when it's unable to open a new browser tab with the server started, but I have no idea how to fix it here.

Upvotes: 3

Views: 4064

Answers (2)

CD..
CD..

Reputation: 74176

I guess #map is some private class field that is supported starting from node 12.

You can try using node 12 or a newer version.

Upvotes: 3

edoput
edoput

Reputation: 1212

I'm guessing you are trying to make a template and using the template syntax

{#map bla bla}

Then the error might just be that map is not supported and you might have to switch to #each

{#each expression as name}...{/each}

Upvotes: 0

Related Questions