Problem deploying sapper site

Hi. I’ve been trying to deploy an update to my site that introduces the Sapper framework. This is based on a template site, and I have managed to get the exact same codebase deploying to romantic-ritchie-74bb1c as a test. But no matter what I do I can’t seem to get my site to build with the error “sh: 1: sapper: not found”.

Like I say, the entire site is the same as one that works so I’m not sure what else I can do. Can you please take a look and hopefully identify what I’m doing wrong?

Thank you!


can you post your package.json please?


"name": "jamesdaisy",

"description": " Website",

"version": "0.1.4",

"scripts": {

    "dev": "sapper dev",

    "build": "sapper build --legacy",

    "export": "sapper export --legacy",

    "start": "node __sapper__/build"


"dependencies": {

    "compression": "^1.7.1",

    "polka": "next",

    "sirv": "^1.0.0"


"devDependencies": {

    "sapper": "^0.28.0",

    "svelte": "^3.17.3",

    "@babel/core": "^7.0.0",

    "@babel/plugin-syntax-dynamic-import": "^7.0.0",

    "@babel/plugin-transform-runtime": "^7.0.0",

    "@babel/preset-env": "^7.0.0",

    "@babel/runtime": "^7.0.0",

    "@rollup/plugin-babel": "^5.0.0",

    "@rollup/plugin-commonjs": "^14.0.0",

    "@rollup/plugin-node-resolve": "^8.0.0",

    "@rollup/plugin-replace": "^2.4.0",

    "@rollup/plugin-url": "^5.0.0",

    "autoprefixer": "^10.2.4",

    "postcss": "^8.2.6",

    "postcss-cli": "^8.3.1",

    "postcss-load-config": "^3.0.1",

    "rollup": "^2.3.4",

    "rollup-plugin-svelte": "^7.0.0",

    "rollup-plugin-terser": "^7.0.0",

    "svelte-preprocess": "^4.6.9",

    "tailwindcss": "^2.0.3"



can you share a screenshot of your build settings as well please?

Add the contents from devDependencies to dependencies.

Thanks for your responses.
Here are my build settings.

I tried putting the devDependencies into dependencies before asking on the forum, and while it did solve the initial error of not finding Sapper it culminated in another error which the solution found online was to make sure that you don’t have the packages in dependencies, so it was catch 22. I can try that approach again but what I don’t understand is why the working application didn’t need that and it works fine. For reference I used this tutorial

and you can see on the source code there that again it doesn’t need/use the dependencies - all in devDependencies. My code matches this technique and it works on one deploy but not on the other.

I have done the clear cache and deploy in the hope that that would clear something out but that hasn’t helped.

Is it possible to have two apps deploying from the same github repo? I was going to try that next (ie point the working deploy repo at the repo for the app that isn’t working) because while a code compare says that all of the files are the same between the working and not working repos I was wondering if there was something not as it seems in the actual repo (although I have manually checked all of the pertinent files in github).

Thanks again for your help

Thanks Perry - here’s my build settings

I had tried this approach of adding to dependencies before raising on the forum. It did initially solve the error but resulted in another problem which googling that suggested that the problem was because I had things in dependencies that should only have been in devDependencies and so I was in a catch 22 where fixing one broke the other.

The other thing that I don’t like about that approach is that I have a working deploy with the same code and that works without adding to dependencies. I’ve used this tutorial as the base for the code and as you’ll see (and in every other example you’ll find out there) noone is adding these things to the dependencies.

Thanks again for your responses

If you don’t want to move all devDependencies to dependencies, I think you can try at least moving sapper because that’s the code that’s returning not found. Netlify doesn’t install devDependencies, thus the error.

Thanks @hrishikesh That’s exactly how I started off trying to fix this myself. I moved sapper, and then it complains about the next one. So I moved that and it complained about the next one, until I’d moved them all. It then didn’t complain about the building, but the site that got deployed was effectively a 500 error page because the build had fallen over in trying to create the static files. Researching that problem the ‘answer’ was that you shouldn’t have your dependency in the dependencies, it should just be in the devDependencies.

So I rolled all that back because everywhere I looked, every tutorial, video etc all showed deploying Sapper to Netlify with these things as devDependencies.

As I’ve said, I then created a second app and second repo. I copied the tutorial and it deployed successfully (with Sapper in devDependencies). I then copied the codebase that isn’t deploying to the new repo and deployed that. And it works.

So I know that I don’t have to have sapper in the dependencies to get the deploy to work because it works on my other instance. I totally understand why your asking me to do this but a) I’ve been down that road once, and b) I have a solution working that doesn’t do what you’re suggesting so why isn’t that working on this particular app? I’m not trying to be “I know better” - I’m just trying to understand why two identical apps need to be coded different to work. :slight_smile:

I’m going to try changing the repo that my second (working) app points to to the first repo that won’t deploy. If I get the error then it would suggest that there is something different in the repos (even though I’ve used Beyond Compare to show that both repos are identical at the file level). I’ll report back what I find.

Thanks for your help.

Would you be willing to share the repo?

Update: I pointed the app that builds to the repo that doesn’t and it still built. I then changed the app that doesn’t build to the repo that does, and it failed. So that tells me that it’s not the codebase - it’s the app setup at Netlify.

To bypass the problem, is it worth just deleting the app that doesn’t build and re-setting up all of the DNS and SSL etc on the app that is building correctly? I don’t like not solving an issue, but I’m not sure that I’m going to get a solution as such.

Sure, you could try that.

After establishing that the code was definitely not the problem I looked again at all of the site settings and found my problem. I had an environment variable set up indicating this was production environment (something left over from a previous test I was doing with Tailwind). That’s the difference between the version that was working and this one that wasn’t. I assume that was then also requiring the dependencies to be more than devDependencies as you suggested @hrishikesh. So my deploy now succeeds, which is good news, although I have a feeling that when I look at whether my Tailwind has now broken as a result of removing the env var I may end up back trying to get things working as production dependencies some time in the future! But that’s for me to solve!

Thanks for your feedback folks - it certainly led me to my solution.


1 Like

glad it is working now!