[英]How to access VueJS on codeanywhere
there.那里。 I´m starting on VueJS, creating a project in codeanywhere:
我开始使用 VueJS,在 codeanywhere 中创建一个项目:
npm install -g vue-cli
vue init webpack myProject
So, when i run npm run dev
i get a所以,当我运行
npm run dev
我得到一个
Your application is running here: http://localhost:8080
您的应用程序在此处运行: http://localhost:8080
Because, i am developing on a cloud based IDE, i´cant access http://localhost ... So, i access the way Codeanywhere publish when you create a project:因为,我在基于云的 IDE 上进行开发,我无法访问http://localhost ... 所以,我在创建项目时访问 Codeanywhere 发布的方式:
https://myProject-XXXXXXXX.codeanyapp.com/
https://myProject-XXXXXXXX.codeanyapp.com/
But i get a但我得到一个
This Container is currently unaccessible.
此容器当前无法访问。
Really appreciated any help.真的很感激任何帮助。
I created a vue.config.js file at the root (next to package.json) with content:我在根目录(package.json 旁边)创建了一个 vue.config.js 文件,内容如下:
module.exports = {
devServer: {
host: '0.0.0.0',
allowedHosts: [
'.codeanyapp.com'
]
}
};
From the Codeanywhere documentation :从Codeanywhere 文档:
You have to change the default IP so your Container could run externally.您必须更改默认 IP,以便您的 Container 可以在外部运行。
Please change IP address on your container from 127.0.0.1 to 0.0.0.0.请将容器上的 IP 地址从 127.0.0.1 更改为 0.0.0.0。
Work for me with nuxt.config.js :使用 nuxt.config.js 为我工作:
server: {
port: 3000,
host: '0.0.0.0',
timing: false
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.