3

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.

  • Node Version: v10.19.0
  • OS: Ubuntu 20.04.1 LTS, 64-bit
  • Browser: Firefox 83.0 (64-bit)
  • Proxy: Burp Suite
0

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

it's true what you say. as a side note, we can check this looking at package.json for something like "engines": {"node": ">= xxx"}. In my case xxx is 12.17.0.
0

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}

1 Comment

The error is pointing towards node_modules, I haven't started coding yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.