question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
benmccanncommented, Feb 19, 2022

You can click the “Versions” tab on npm: https://www.npmjs.com/package/@sveltejs/adapter-vercel Or view the changelog: https://github.com/sveltejs/kit/blob/master/packages/adapter-vercel/CHANGELOG.md

You should use versions that were released at the same time. If you keep both updated to the latest that’s an easy way to do it

0reactions
benmccanncommented, Feb 19, 2022

That’s not going to happen until 1.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read properties of undefined (reading 'rimraf') #3300
Running npm run build errors out with Cannot read properties of undefined (reading 'rimraf') . There was an issue producing the exact same...
Read more >
I keep getting builder.rimraf is not a function when i build npm
This sounds like you're on an old version of @sveltejs/adapter-netlify that is incompatible with the latest version of SvelteKit.
Read more >
vercel-adapter build error : r/sveltejs - Reddit
Hey guys, i currently came across this error when i'm trying to build and deploy my app to vercel. TypeError: utils.rimraf is not...
Read more >
@types/rimraf - npm
Start using @types/rimraf in your project by running `npm i ... There are 382 other projects in the npm registry using @types/rimraf.
Read more >
Npm install command failing with message "could not find ...
I was following the project setup. When I run the npm install command, npm starts downloading the dependencies. But then, suddenly, it stops ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found