Skip to content

Cannot read properties of undefined (reading 'rimraf') #3300

@boojum

Description

@boojum

Describe the bug

Running npm run build errors out with Cannot read properties of undefined (reading 'rimraf').

There was an issue producing the exact same error message (#3111) while using @sveltejs/adapter-node and @sveltejs/adapter-static. The reason was an outdated @sveltejs/kit package. It's not the case here as all packages are at their latest versions (see System Info below).

Reproduction

  1. Clone the example repo: g clone https://gitlab.com/i1847/sveltekit-cloudflare-rimraf
  2. cd sveltekit-cloudflare-rimraf
  3. npm run build

Logs

> npm run build

> sveltekit-rimraf@0.0.1 build
> svelte-kit build

vite v2.7.10 building for production...
✓ 13 modules transformed.
.svelte-kit/output/client/_app/manifest.json                    1.15 KiB
.svelte-kit/output/client/_app/layout.svelte-d4f4d2d6.js        0.53 KiB / gzip: 0.35 KiB
.svelte-kit/output/client/_app/error.svelte-4db5dde0.js         1.56 KiB / gzip: 0.75 KiB
.svelte-kit/output/client/_app/pages/index.svelte-78738526.js   0.80 KiB / gzip: 0.47 KiB
.svelte-kit/output/client/_app/chunks/vendor-f0095a1c.js        7.21 KiB / gzip: 2.96 KiB
.svelte-kit/output/client/_app/start-8c59df0d.js                20.09 KiB / gzip: 6.96 KiB
vite v2.7.10 building SSR bundle for production...
✓ 11 modules transformed.
.svelte-kit/output/server/manifest.json                    0.87 KiB
.svelte-kit/output/server/app.js                           48.19 KiB
.svelte-kit/output/server/entries/pages/layout.svelte.js   0.24 KiB
.svelte-kit/output/server/entries/pages/error.svelte.js    0.72 KiB
.svelte-kit/output/server/entries/pages/index.svelte.js    0.32 KiB
.svelte-kit/output/server/chunks/index-2dc61825.js         2.24 KiB

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-cloudflare
> Cannot read properties of undefined (reading 'rimraf')
    at adapt (file:///home/boojum/sveltekit-rimraf/node_modules/@sveltejs/adapter-cloudflare/index.js:15:10)
    at adapt (file:///home/boojum/sveltekit-rimraf/node_modules/@sveltejs/kit/dist/chunks/index5.js:738:8)
    at file:///home/boojum/sveltekit-rimraf/node_modules/@sveltejs/kit/dist/cli.js:931:11


### System Info

```shell
System:
    OS: Linux 5.13 Ubuntu 21.10 21.10 (Impish Indri)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1195G7 @ 2.90GHz
    Memory: 23.35 GB / 31.07 GB
    Container: Yes
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.3.1 - /usr/bin/node
    npm: 8.3.0 - /usr/bin/npm
  Browsers:
    Chrome: 97.0.4692.71
    Firefox: 96.0
  npmPackages:
    @sveltejs/adapter-cloudflare: ^1.0.0-next.2 => 1.0.0-next.2 
    @sveltejs/kit: ^1.0.0-next.225 => 1.0.0-next.225 
    svelte: ^3.46.0 => 3.46.0

Severity

Blocking all usage of SvelteKit with @sveltejs/adapter-cloudflare.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions