Skip to content

Adapter "cannot find module" as of upgrade to recent version #3210

Closed
@wallw-teal

Description

@wallw-teal

Describe the bug

I have an error that has cropped up in @sveltejs/[email protected] and @sveltejs/[email protected]. I have a component that uses an OpenLayers map and I get the following from the adapter portion of the build:

Run npm run preview to preview your production build locally.

Using @sveltejs/adapter-node
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '<monorepo_project>/node_modules/ol/Feature' imported from <monorepo_project>/packages/app/.svelte-kit/output/server/entries/pages/search.svelte.js
Did you mean to import ol/Feature.js?
    at new NodeError (node:internal/errors:371:5)
    at finalizeResolution (node:internal/modules/esm/resolve:416:11)
    at moduleResolve (node:internal/modules/esm/resolve:932:10)
    at defaultResolve (node:internal/modules/esm/resolve:1044:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36)

This worked as of 193/55, I first saw the error in 202/56, and still see it in 215/60. I do not think it is specific to that import, since if I remove it, it just complains about another file from OpenLayers instead. <monorepo_project>/node_modules/ol/Feature.js exists, so I do not know why it is having trouble finding that.

I should note that npm run dev works fine and does not complain about anything

Reproduction

See minimal reproduction at https://github.com/wallw-bits/svelte-kit-ol-issue-repro and npm i followed by npm run build.

Logs

No response

System Info

System:
    OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 6.19 GB / 31.11 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 7.24.2 - ~/workspace/saffire/ui/node_modules/.bin/npm
  Browsers:
    Chrome: 96.0.4664.110
    Firefox: 95.0.1
  npmPackages:
    @sveltejs/adapter-node: ^1.0.0-next.60 => 1.0.0-next.60 
    @sveltejs/kit: ^1.0.0-next.215 => 1.0.0-next.215 
    svelte: ^3.44.3 => 3.44.3

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions