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

2
  • 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). Commented Aug 12, 2018 at 2:03
  • Apologies, I should have included the files. I added the repo with all my files to my main post. Here it is again: github.com/Taikon/MaroonRiver0 Commented Aug 12, 2018 at 2:55

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Oh my god thank you so much! It worked! So now I know I have to run build everytime I make a change

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.