Run a Vue.js project in server without " npm run dev " command?

17,037

Solution 1

It's not Vue specific but you also should be able to run npm run build which generates production bundles in /dist subfolder of your project. You are supposed to copy this folder to the production server and configure the server so that it serves dist/index.html for every URL.

Solution 2

If you are using the "webpack", "webpack-simple" or "pwa" template there is a dedicated command for creating the production build, which allows a static hosting (with no need to run any npm process in the server):

npm run build

It will create a dist folder which content you can upload to the root of your server.


Some more info about:

Share:
17,037
Sandip Nag
Author by

Sandip Nag

Updated on June 17, 2022

Comments

  • Sandip Nag
    Sandip Nag almost 2 years

    After installing vue cli globally by running npm install -g vue-cli, I have installed all the modules in the project folder "myBlog" by running npm install and can run the project in my local environment by using npm run dev. But when I am going to move this project in the live server is this is the right way to run the batch program (npm run dev) continuously or there are other ways to run the project without running npm run dev continuously?