0

I am trying to run a svelte project with the following command

> npm run dev

but I am getting this error

ERROR
    Invalid command: dev

  Run `$ svelte-kit --help` for more info.

svelte-kit is installed as dev dependency in my project, and my Package.json has a script defined.

{
  "name": "xyz",
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite dev",
    "build": "vite build",
    "preview": "vite preview",
    "test": "vitest",
    "test:e2e": "playwright test"
  },
  "devDependencies": {
    "@playwright/test": "^1.51.1",
    "@sveltejs/adapter-auto": "^6.0.0",
    "@sveltejs/kit": "^2.20.7",
    "@sveltejs/vite-plugin-svelte": "^5.0.3",
    "autoprefixer": "^10.4.21",
    "postcss": "^8.5.3",
    "prettier": "^3.5.3",
    "svelte": "^5.27.0",
    "svelte-preprocess": "^6.0.3",
    "tailwindcss": "^4.1.4",
    "typescript": "^5.8.3",
    "uuid": "^11.1.0",
    "vite": "6.2.6",
    "vitest": "^3.1.1"
  }
}

I want to know what problems I am facing. Are there any issues with the dev dependencies?

6
  • 1
    Depends on the contents of package.json. If there's no dev field defined in "scripts" block this won't work. For a default project its vite dev, so maybe give that a go ? Commented Apr 16 at 6:30
  • added vite instead of svelte-kit in dev, but then i got this error could not resolve error during build : could not resolve enry module "index.html".
    – Prat13k
    Commented Apr 16 at 7:29
  • 1
    Hello @JorgeLinares , I have edited whole package.json file in the main question, please check it out.
    – Prat13k
    Commented Apr 16 at 11:14
  • 1
    Thanks! Everything looks ok there actually, the new message seems to indicate some problem with your vite.config.ts, it should be looking for app.html instead of index.html as an entry module. Make sure you have it configured to use the sveltekit plugin. You mind sharing it in the question as well? Commented Apr 17 at 18:12
  • 1
    I found the solution, it was only about importing files using path.resolve rather than simply calling them. Thanks for your time. @JorgeLinares
    – Prat13k
    Commented Apr 20 at 6:30

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.