Search code examples
javascriptsveltenetlifyvercelsveltekit

I keep getting builder.rimraf is not a function when i build npm


I am trying to make my svelteapp prodcution ready and therefor running npm run build I have tried with several adapters but i keep getting the same error saying

> Using @sveltejs/adapter-netlify
> builder.rimraf is not a function

The application itself runs fine with npm run dev.

I have searched everywhere. tried the following

  • node version 16.14.0 also tried with older version and the newest 17.5.0
  • Deleting node_modules and ran npm i again
  • deleting package-lock.json
  • tried another adapter like adapter-vercel and adapter-auto that comes with sveltekit

Solution

  • This sounds like you're on an old version of @sveltejs/adapter-netlify that is incompatible with the latest version of SvelteKit. Try running the following to update to the latest versions of everything:

    npm i @sveltejs/kit@next
    npm i @sveltejs/adapter-netlify@next