Skip to content

"Cannot read property 'rimraf' of undefined" when building using adapter-vercel #3999

@natevaughan

Description

@natevaughan

Describe the bug

Hi, I'm upgrading SvelteKit to ^1.0.0-next.278 in order to take advantage of some newer features like afterNavigate.

The build and runtime work locally but I'm getting the following failure on Vercel:

> Using @sveltejs/adapter-vercel
> Cannot read property 'rimraf' of undefined
    at adapt (file:///vercel/path0/node_modules/@sveltejs/adapter-vercel/index.js:17:10)
    at adapt (file:///vercel/path0/node_modules/@sveltejs/kit/dist/chunks/index5.js:881:8)
    at file:///vercel/path0/node_modules/@sveltejs/kit/dist/cli.js:1062:11

I've cleared the build cache on Vercel.

Reproduction

Run the following repo locally and deploy to Vercel. It should work locally but fail on Vercel.

https://github.com/natevaughan/launcher/tree/upgrade-sveltekit

Logs

Cloning github.com/natevaughan/launcher (Branch: main, Commit: e42023e)
Cloning completed: 661.173ms
Analyzing source code...
Installing build runtime...
Build runtime installed: 2.984s
Looking up build cache...
Build Cache not found
Detected package.json
Installing dependencies...
Detected `package-lock.json` generated by npm 7...
> launcher@0.0.1 postinstall
> prisma generate || true
Prisma schema loaded from prisma/schema.prisma
✔ Generated Prisma Client (3.6.0 | library) to ./node_modules/@prisma/client in 229ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()

added 424 packages in 18s
62 packages are looking for funding
  run `npm fund` for details
> launcher@0.0.1 build /vercel/path0
> svelte-kit build
vite v2.8.4 building for production...
transforming...
// ...
Run npm run preview to preview your production build locally.
> Using @sveltejs/adapter-vercel
> Cannot read property 'rimraf' of undefined
    at adapt (file:///vercel/path0/node_modules/@sveltejs/adapter-vercel/index.js:17:10)
    at adapt (file:///vercel/path0/node_modules/@sveltejs/kit/dist/chunks/index5.js:881:8)
    at file:///vercel/path0/node_modules/@sveltejs/kit/dist/cli.js:1062:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! launcher@0.0.1 build: `svelte-kit build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the launcher@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /vercel/.npm/_logs/2022-02-18T21_24_46_615Z-debug.log
Error: Command "npm run build" exited with 1

System Info

Vercel

Severity

blocking an upgrade

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