Skip to content

adapter-node makes build dependent on dev dependencies #5944

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

Closed
SylvainGarrigues opened this issue Aug 16, 2022 · 3 comments
Closed

adapter-node makes build dependent on dev dependencies #5944

SylvainGarrigues opened this issue Aug 16, 2022 · 3 comments

Comments

@SylvainGarrigues
Copy link

SylvainGarrigues commented Aug 16, 2022

Describe the bug

Just run the build directory:

# node build/
node:internal/errors:465
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'devalue' imported from /usr/src/zzz/build/server/index.js
    at new NodeError (node:internal/errors:372:5)
    at packageResolve (node:internal/modules/esm/resolve:954:9)
    at moduleResolve (node:internal/modules/esm/resolve:1003:20)
    at defaultResolve (node:internal/modules/esm/resolve:1218:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Reproduction

my-svelte-app # npm run build
my-svelte-app # mkdir ../my-app-run && cd ../my-app-run
my-app-run # npm install --omit=dev
my-app-run # node build/
node:internal/errors:465
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'devalue' imported from /usr/src/zzz/build/server/index.js
    at new NodeError (node:internal/errors:372:5)
    at packageResolve (node:internal/modules/esm/resolve:954:9)
    at moduleResolve (node:internal/modules/esm/resolve:1003:20)
    at defaultResolve (node:internal/modules/esm/resolve:1218:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Logs

No response

System Info

# npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"
Need to install the following packages:
  envinfo
Ok to proceed? (y) y

  System:
    OS: Linux 5.15 Alpine Linux
    CPU: (4) arm64 Cortex-A72
    Memory: 1.13 GB / 1.81 GB
    Container: Yes
    Shell: 1.35.0 - /bin/ash
  Binaries:
    Node: 16.16.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.11.0 - /usr/local/bin/npm
  npmPackages:
    @sveltejs/adapter-node: 1.0.0-next.85 => 1.0.0-next.85 
    @sveltejs/kit: next => 1.0.0-next.411 
    svelte: ^3.49.0 => 3.49.0 
    vite: ^3.0.4 => 3.0.8

Severity

serious, but I can work around it

Additional Information

Can work around it by installing dev dependencies

@Conduitry
Copy link
Member

Duplicate of #3176.

@Conduitry Conduitry closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2022
@SylvainGarrigues
Copy link
Author

Is this really related? The documentation for adapter-node (see README) says I can just npm ci --prod && node build and be running straight away, it used to be the case until recently, now I need to use npm ci alone, while my code didn't change at all and I don't have external dependencies.

@SylvainGarrigues
Copy link
Author

Running npm install devalue after npm ci --prod and before node build solves this issue. I am not sure this is a really a duplicate of #3176

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