I want to try out the new SvelteKit replacement for Sapper, but I'm not able to start a dev server.
npm init svelte@next
npm install
npm run dev -- --open
(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.
v10.19.0
Ubuntu 20.04.1 LTS, 64-bit
Firefox 83.0 (64-bit)
Burp Suite
Updating node to version 12+ removed the error and enabled starting the dev server.
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.
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}
Svelte Kit isn't even in a public alpha yet, it's simply not ready for use yet, which is why it doesn't work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.