Skip to content

Instantly share code, notes, and snippets.

@richard-flosi
Created July 14, 2020 00:08
Show Gist options
  • Save richard-flosi/766040cec9bd2ea5da7a33bc01706de4 to your computer and use it in GitHub Desktop.
Save richard-flosi/766040cec9bd2ea5da7a33bc01706de4 to your computer and use it in GitHub Desktop.
Build Script to Deploy Flutter Web app on Netlify
#!/bin/bash
# Get flutter
git clone https://github.com/flutter/flutter.git
FLUTTER=flutter/bin/flutter
# Configure flutter
FLUTTER_CHANNEL=master
FLUTTER_VERSION=v1.17.0
$FLUTTER channel $FLUTTER_CHANNEL
$FLUTTER version $FLUTTER_VERSION
$FLUTTER config --enable-web
# Build flutter for web
$FLUTTER build web
echo "OK"
[build]
command = "./build.sh"
publish = "build/web"
@Gene-Dana
Copy link

Hi there ! I was wondering if you could perhaps explain this to me !

@Gene-Dana
Copy link

I keep getting this error ! bash: ./build.sh: Permission denied

@richard-flosi
Copy link
Author

@Gene-Dana sounds like you need to add execute permission to your build.sh file.
chmod u+x build.sh, then commit that change and push and see if netlify can run it now.

@Gene-Dana
Copy link

I see that was the error I had ! I tried a similar command from another post and I didn't make it executable from my side. Thanks !

@pyplacca
Copy link

Hi, @richard-flosi
Your gist has been quite helpful. However, Netlify failed to complete the build of my app with the error shown in the screenshot attached below.

Screenshot 2023-03-24 at 16 50 16

Do you have any suggestions on how I can fix that? Your help would be greatly appreciated 🙏.

@Gene-Dana
Copy link

Do you have any suggestions on how I can fix that? Your help would be greatly appreciated 🙏.

It seems as if there were issues giving executable permissions to the build file.

I wrote a guide here that you can use to make certain every step is correct

https://learn2teach.super.site/links/knowledge-bank/topics/product/how-to-properly-deploy-flutter-web-with-netlify

@pyplacca
Copy link

Do you have any suggestions on how I can fix that? Your help would be greatly appreciated 🙏.

It seems as if there were issues giving executable permissions to the build file.

I wrote a guide here that you can use to make certain every step is correct

https://learn2teach.super.site/links/knowledge-bank/topics/product/how-to-properly-deploy-flutter-web-with-netlify

Thanks, @Gene-Dana. I'll read the guide

@pyplacca
Copy link

Thanks, @Gene-Dana
Got the app live and running.

@Gene-Dana
Copy link

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment