提问者:小点点

SvelteKit开发服务器未启动


我想试用Sapper的新SvelteKit替代品,但我无法启动一个开发服务器。

我运行的命令

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.

我还没有接触生成的代码。

我知道当服务器启动时无法打开新的浏览器选项卡时会弹出这些类型的错误,但我不知道如何在这里修复它。

节点版本

v10.19.0

OS

Ubuntu 20.04.1 LTS,64位

浏览器

Firefox 83.0(64位)

代理

打嗝套房


共1个答案

匿名用户

我猜您正在尝试制作一个模板并使用模板语法

{#map bla bla}

则错误可能只是不支持map,您可能必须切换到#each

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