Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing dependencies with only package.json (and lockfile) present fails #4366

Closed
Conduitry opened this issue Mar 17, 2022 · 1 comment · Fixed by #4372
Closed

Installing dependencies with only package.json (and lockfile) present fails #4366

Conduitry opened this issue Mar 17, 2022 · 1 comment · Fixed by #4372
Labels
bug Something isn't working p1-important SvelteKit cannot be used by a large number of people, basic functionality is missing, etc.
Milestone

Comments

@Conduitry
Copy link
Member

Describe the bug

As noted here, when dependencies are installed when only package.json (and a lockfile) are present results in a failure during @sveltejs/kit's prepare script, which runs svelte-kit sync, which expects a full app to be present. Installing in this way is common when using multi-stage Docker builds, to optimize layer caching.

Reproduction

  1. Create a new project
  2. Delete everything except package.json
  3. Install dependencies

Logs

> You need to create a svelte.config.js file. See https://kit.svelte.dev/docs/configuration
    at load_config (file:///.../node_modules/.pnpm/@[email protected][email protected]/node_modules/@sveltejs/kit/dist/cli.js:780:9)
    at file:///.../node_modules/.pnpm/@[email protected][email protected]/node_modules/@sveltejs/kit/dist/cli.js:1000:25
    at o.parse (/.../node_modules/.pnpm/[email protected]/node_modules/sade/lib/index.js:1:3402)
    at file:///.../node_modules/.pnpm/@[email protected][email protected]/node_modules/@sveltejs/kit/dist/cli.js:1008:6
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

System Info

System:
    OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
    Memory: 23.46 GB / 24.98 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Yarn: 1.22.15
    npm: 8.5.2
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.33
    @sveltejs/kit: next => 1.0.0-next.299
    svelte: ^3.46.0 => 3.46.4

Severity

blocking an upgrade

Additional Information

Making svelte-kit sync a no-op when there's no svelte.config.js might be a step in the right direction, but I'm not positive that would be enough.

Maybe, when using Docker, the next build stage would have to run svelte-kit sync before it runs svelte-kit build? I'm not sure whether sync does anything that build wouldn't.

@Conduitry Conduitry added bug Something isn't working p1-important SvelteKit cannot be used by a large number of people, basic functionality is missing, etc. labels Mar 17, 2022
@Conduitry Conduitry added this to the 1.0 milestone Mar 17, 2022
@Conduitry
Copy link
Member Author

It looks like making sync a no-op might in fact be enough. (Maybe it could print a warning, as long as it still has a 0 exit code.) Anything in .svelte-kit that sync would have generated is also generated by build (and by dev for that matter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p1-important SvelteKit cannot be used by a large number of people, basic functionality is missing, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant