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):
App running at: - Local: http://localhost:8080/ - Network: http://1.2.3.4:8080/
Everything works fine on my own computer. On my own computer I can access both by Local and by IP address, but I cannot access with network address on other devices connected to the same wifi network.
I have tried the following:
On vue.config.js: devServer: { host: '0.0.0.0' } and devServer: { open: process.platform === 'darwin', host: '0.0.0.0', port: 8080, https: false, hotOnly: false } on my package.json: "scripts": { "serve": "vue-cli-service serve --host 0.0.0.0", "build": "vue-cli-service build", "lint": "vue-cli-service lint" } and "scripts": { "serve": "vue-cli-service serve --host 0.0.0.0 --allowed-hosts 1.2.3.4", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }
My tomcat server runs on port 80, and that works fine on both my computer and other devices...I am not sure what else to do...
This is the error page I run into: How can I make it so that I can access my vue project from other devices on the same network?
Thank you for your time and help!
To solve the error "'vue-cli-service' is not recognized as an internal or external command, operable program or batch file", install the @vue/cli-service package globally by running npm install -g @vue/cli-service and clear your npm cache.
Deploying the Vue sample app Navigate to the root folder of the application in the command line. Type npm install --global surge to install Surge on your computer. Type npm run build to build the application and make it production-ready. Type cd dist to navigate to the build folder.
Till the date, npm run serve
in any Vue.js project will allow you to access the project from any device locally or in the network (App running at):
In case that you are in Windows (as the host) and the project isn't accessible from other devices in the network at the mentioned address by the CLI, you need to allow inbound connections of Node.js in your Firewall settings:
Search for the Node.js related rules and modify them, allowing the inbound connections:
In my case I had 4 rules related to Node.js, after allowing the inbound connections, I was able to access the project served from my Desktop in my Mobile Device in the same network.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With