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

后端 未结 2 1520
挽巷
挽巷 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.

    0 讨论(0)
  • 2021-02-05 09:40

    Because you only access your device. Lets try remove --allowed-hosts 1.2.3.4

    0 讨论(0)
提交回复
热议问题