非常简单,只要加一个配置!
第1步,复制这个代码(端口可改)
"config": { "nuxt": { "host": "0.0.0.0", "port": "8090" } },
第2步,找到根目录下的package.json,把代码粘贴进去。
这是全部的代码,我这里配置在了8~13行。
{ "name": "guanWangPhone", "version": "1.0.0", "description": "My bee's knees Nuxt.js project", "author": "kason", "private": true, "config": { "nuxt": { "host": "0.0.0.0", "port": "8090" } }, "scripts": { "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server", "build": "nuxt build", "start": "cross-env NODE_ENV=production node server/index.js", "generate": "nuxt generate" }, "dependencies": { "cross-env": "^5.2.0", "element-ui": "^2.4.11", "koa": "^2.6.2", "nuxt": "^2.0.0", "postcss-px2rem": "^0.3.0" }, "devDependencies": { "node-sass": "^4.13.0", "nodemon": "^1.18.9", "sass-loader": "^8.0.0", "scss-loader": "0.0.1" } }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“nuxt配置通过指定IP和端口访问的实现”评论...