Cannot access Vue project by IP address on other devices vue cli 3 npm

后端 未结 2 1512
挽巷
挽巷 2021-02-05 08:55

I have a project created with vue cli 3. When I run the command \"npm run serve\", it gives the following success message (I replaced my IP address with fake #\'s):



        
2条回答
  •  情歌与酒
    2021-02-05 09:27

    Firstly, in the host param of the devserver you have to add the legit IP adress of your router, for it to work, but if you dont require specific settings, just want it to be served on your network:

    I usually just do this in my package.json:

     "serve": "vue-cli-service serve",
    

    and vue.config.js, you can remove everything that is related to devServer. This will create a dev server that will work on your network.

提交回复
热议问题