0

I made a website with Vue.js and included Snipcart API for a buy button. I've been trying to deploy it to heroku for 2 days now.

When I enter $ npm run dev it works fine and will display my web app. But for some reason if I do $ node server.js it shows the default Vue welcome page for its webpack ("Welcome to Your Vue App").

I've tried entering "start":"npm run dev" in my package.json but that just results in a forever loading web page. If I enter "start":"node server.js" It results in the same thing as the previous paragraph, it just shows the default Vue welcome page.

I found someone with basically the same issue (How to set up vue(2)-cli app to run with nodejs server) and even tried the same tutorial post but I don't know what that comment/answer is talking about. I am also unsure of how to deploy a static website with a Snipcart API (as a previous user mentioned to me in a previous post).

I am really at a loss as to what to do. Thanks for your time.

Edit: Here is the repo for my app: https://github.com/Taikon/MaroonRiver0

cozimo
  • 95
  • 1
  • 1
  • 9
  • Without more information, it seems like `npm run dev` is running some sort of live server without actually building anything. and `npm start` serves the built assets (which are still the defaults because you didn't build anything). – Slava Knyazev Aug 12 '18 at 02:03
  • Apologies, I should have included the files. I added the repo with all my files to my main post. Here it is again: https://github.com/Taikon/MaroonRiver0 – cozimo Aug 12 '18 at 02:55

1 Answers1

1

Exactly what I suspected in the comment: You are not building your assets.

Run

npm run build
node server.js

And it should work as expected.

Slava Knyazev
  • 5,377
  • 1
  • 22
  • 43
  • Oh my god thank you so much! It worked! So now I know I have to run build everytime I make a change – cozimo Aug 12 '18 at 18:00