I deployed a surge.sh project and it was published successfully, however, I want to make some updates to the project, the updates have been applied locally and can be seen working but it tried to publish it to the same domain again yet it doesn't appear updated. I also tried to tear down the project and re-upload it still it shows the old project, I cleared the cache too but it still didn't update. Any idea why?
-
1I have a friend running into this problem as well. She mentioned after a few hours of re-deploying (without tearing down first) it was updated. But I'm not sure why it's taking that long. (It's always been immediate for me in the past). If I find an answer I'll post it here. – bobbyz Apr 30 '18 at 15:32
-
I switched from hosting my site on GitHub pages, and I am also disappointed by this problem with surge.sh. On GitHub pages changes would always be immediately. It did work for me to tear down the site and put it back up again, but there should be a way to have updates happen right away without having to tear the site down every time. – Adam D Jul 31 '18 at 09:46
7 Answers
To update a project you just need to publish it again to the same domain.
You can do this quickly by creating a file called CNAME in the project root directory to set the default domain name, like this:
echo site-name.surge.sh >CNAME
Then each time to update:
surge .
Alternatively, without a CNAME file, specify the domain in the surge command like this:
surge --domain site-name.surge.sh .
See https://surge.sh/help/remembering-a-domain .
This will not solve the need to tear down and republish the site described in the original post, but if you're not having that problem, it will make it quick to update your surge.sh project, as per the title question, without the need to edit the domain the usual prompt.

- 1,462
- 13
- 33
- Open Git Bash.
- Switch to the project directory.
- Type
surge
and click Enter. - Click Enter in line "project".
- Enter URL of your project in line "domain" and click Enter.
That's it!

- 997
- 1
- 15
- 25

- 514
- 1
- 9
- 14
-
I don't think this is it. I have the same problem. Every time I deploy a new version, I need to do a hard refresh. For my coworker, he has to do a hard refresh *every time he looks at the page*. – realisation Apr 06 '20 at 21:39
Use the following deploy script to update your deployed Surge Project
"deploy": "surge --project ./path_to_build_folder --domain custom-domain.surge.sh"

- 13,461
- 8
- 60
- 73
Just go to your project folder, use cd
to select your project directory, then type npm run build
, then change directory to build directory cd build
and then use surge
Edit: Example \
- You need go to your project directory, in my case it's jamming
$ cd ../
King@DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming (main)
$ pwd
/c/Users/King/Documents/Projects/jamming
King@DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming (main)
- Then you do
npm run build
, I guess you need to update the build.
King@DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming (main)
$ npm run build
- Once the build is compiled, go in to the build directory by using
cd build
and then dosurge
King@DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming (main)
$ cd build
King@DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming/build
$ surge
That's how it worked with me. If I don't do npm run build
before the surge
just won't update it... I don't know if this is the right way...

- 1
- 1
To update your Surge project, simply run surge
in the project directory and input the same domain you're already using in the domain:
prompt.
Some users are describing a problem where they have to do a hard refresh to see their updates. This is to be expected, and happens with any static file host, since static files are cached by your browser to make page loads faster.
So to see the latest version of your Surge site, press Ctrl+Shift+J or F12 to open the developer tools, and right-click on the reload button in the browser's unibar, and click on Empty Cache and Hard Reload.

- 4,503
- 4
- 21
- 42
- Open Cmd.
- Switch to the project directory.
- Type surge . and click Enter.
- and change the random domain with your web that's want to update and hit enter.
That's it <3

- 11
- 3
Go to the directory project and use git or cmd and this structure:
- type surge and hit enter
- hit enter in project line
- replace the random domain with your web url
- hit enter

- 1,240
- 1
- 14
- 28

- 11
- 3