npm 运行Svelte时出现意外选项config.kit.methodOverride

x8diyxa7  于 2023-03-08  发布在  其他
关注(0)|答案(1)|浏览(154)

我目前正在进行一个Svelte项目,并使用提供的迁移工具更新到最新版本。然而,该项目不再与NPM交互。
运行npm i将安装节点模块,但返回以下错误:
> Unexpected option config.kit.methodOverride
并运行npm run dev得到以下结果:

ERROR Invalid command: dev
 Run `$ svelte-kit --help` for more info.

这两个错误无法传递,并且通过npm的其他命令也不起作用。
下面是我正在使用的package.json

{
    "name": "project",
    "version": "0.0.1",
    "scripts": {
        "dev": "svelte-kit dev",
        "build": "svelte-kit build",
        "package": "svelte-kit package",
        "preview": "svelte-kit preview",
        "prepare": "svelte-kit sync",
        "check": "svelte-check --tsconfig ./tsconfig.json",
        "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
        "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
        "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
    },
    "devDependencies": {
    "@sveltejs/adapter-auto": "next",
        "@sveltejs/kit": "next",
        "@types/cookie": "^0.4.1",
        "@typescript-eslint/eslint-plugin": "^5.10.1",
        "@typescript-eslint/parser": "^5.10.1",
        "eslint": "^8.12.0",
        "eslint-config-prettier": "^8.3.0",
        "eslint-plugin-svelte3": "^4.0.0",
        "prettier": "^2.5.1",
        "prettier-plugin-svelte": "^2.5.0",
        "sass": "^1.51.0",
        "svelte": "^3.46.0",
        "svelte-check": "^2.2.6",
        "svelte-preprocess": "^4.10.6",
        "tslib": "^2.3.1",
        "typescript": "~4.6.2"
    },
    "type": "module",
    "dependencies": {
        "@fontsource/fira-mono": "^4.5.0",
        "@lukeed/uuid": "^2.0.0",
        "cookie": "^0.4.1",
        "svelte-navigator": "^3.2.2"
    }
}
gupuwyp2

gupuwyp21#

config.kit.methodOverride是SvelteKit配置中较旧的选项。请确保您的配置是正确的,最简单的方法是使用npm create svelte启动一个新项目,并至少比较 package.jsonsveltekit.config.js 文件。

相关问题