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

@sveltejs/adapter-node gained undocumented runtime dependencies #6048

Closed
sserdyuk opened this issue Aug 18, 2022 · 1 comment
Closed

@sveltejs/adapter-node gained undocumented runtime dependencies #6048

sserdyuk opened this issue Aug 18, 2022 · 1 comment

Comments

@sserdyuk
Copy link

sserdyuk commented Aug 18, 2022

Describe the bug

We use adapter-node to build and deploy our app to staging. We normally copy the build folder and run npm ci --omit=dev --ignore-scripts to install runtime dependencies we use. SvelteKit used to package everything into the build folder. Over that last two weeks, a change was made, and the build now has three runtime dependencies that aren't installed unless you install dev packages. Not sure if it was an oversight in the documentation or the development. We worked around the issue by adding these packages as runtime dependencies in the package.json file.

  "dependencies": {
    "cookie": "^0.5.0",
    "devalue": "^2.0.1",
    "set-cookie-parser": "^2.5.1"
  }

Reproduction

  1. Clone https://github.com/sserdyuk/bug-08-18
  2. Install all packages npm ci
  3. Build the app npm run build
  4. Run node build/index.js to confirm that the app starts
  5. Reinstall only runtime dependencies npm ci --omit=dev --ignore-scripts
  6. Run node build/index.js to confirm that the app now fails

Logs

@> npm ci

added 207 packages, and audited 208 packages in 2s

41 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
@> npm run build

> [email protected] build
> vite build

vite v3.0.8 building for production...
✓ 30 modules transformed.
.svelte-kit/output/client/vite-manifest.json                                         2.09 KiB
.svelte-kit/output/client/_app/immutable/components/layout.svelte-e105e7df.js        0.53 KiB / gzip: 0.35 KiB
.svelte-kit/output/client/_app/immutable/components/error.svelte-6f84932b.js         1.97 KiB / gzip: 0.91 KiB
.svelte-kit/output/client/_app/immutable/components/pages/_page.svelte-4f83cedf.js   0.81 KiB / gzip: 0.47 KiB
.svelte-kit/output/client/_app/immutable/chunks/0-6eff01a1.js                        0.12 KiB / gzip: 0.11 KiB
.svelte-kit/output/client/_app/immutable/chunks/index-df6a2127.js                    6.73 KiB / gzip: 2.74 KiB
.svelte-kit/output/client/_app/immutable/chunks/1-ca9c5b7c.js                        0.11 KiB / gzip: 0.11 KiB
.svelte-kit/output/client/_app/immutable/chunks/2-5a5e5908.js                        0.12 KiB / gzip: 0.12 KiB
.svelte-kit/output/client/_app/immutable/start-153896cf.js                           22.58 KiB / gzip: 8.67 KiB
vite v3.0.8 building SSR bundle for production...
✓ 35 modules transformed.
Generated an empty chunk: "hooks"
.svelte-kit/output/server/vite-manifest.json                   1.11 KiB
.svelte-kit/output/server/index.js                             60.96 KiB
.svelte-kit/output/server/entries/fallbacks/layout.svelte.js   0.23 KiB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js    1.32 KiB
.svelte-kit/output/server/entries/pages/_page.svelte.js        0.31 KiB
.svelte-kit/output/server/chunks/index.js                      3.10 KiB
.svelte-kit/output/server/chunks/hooks.js                      0.00 KiB

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-node
  ✔ done
 @> node build/index.js 
Listening on 0.0.0.0:3000
^C
 @> npm ci --omit=dev --ignore-scripts

up to date, audited 1 package in 310ms

found 0 vulnerabilities
@> node build/index.js 
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'devalue' imported from /home/sergei/Projects/Svelte/ddd/build/server/index.js
    at new NodeError (node:internal/errors:371:5)
    at packageResolve (node:internal/modules/esm/resolve:930:9)
    at moduleResolve (node:internal/modules/esm/resolve:976:18)
    at defaultResolve (node:internal/modules/esm/resolve:1078:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

System Info

System:
    OS: Linux 5.4 Ubuntu 18.04.6 LTS (Bionic Beaver)
    CPU: (16) x64 AMD Ryzen 7 5700G with Radeon Graphics
    Memory: 18.21 GB / 30.74 GB
    Container: Yes
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 16.14.0 - ~/.bin/node/bin/node
    npm: 8.3.1 - ~/.bin/node/bin/npm
  Browsers:
    Chrome: 104.0.5112.79
    Firefox: 103.0

Severity

serious, but I can work around it

Additional Information

No response

@Conduitry
Copy link
Member

Duplicate of #3176, #4285, #5222, #5944, #5968, #6027. I've commented with my own workaround in #3176 (comment).

@Conduitry Conduitry closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants