新建vue遇到的一些问题

1,安装node.js

Node.js官网:https://nodejs.org/en/

进入Node.js官网,选择下载并安装Node.js。安装过程只需要点击“下一步”即可

安装完输入node -v出现版本号表示node安装成功

2.
npm的国内淘宝镜像cnpm 命令行工具代替默认的npm
npm install -g cnpm --registry=https://registry.npm.taobao.org
npm install vue

3.
安装脚手架
sudo c    

npm install -g vue-cli

//vue init webpack myvue [这里项目名不能有大写字母]
//myvue是项目名


===================================
Vue中eslint报错的修改,绝对有效!!!

Syntax Error: TypeError: Cannot read properties of undefined (reading 'parseComponent')

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
————————————————
解决办法:
npm upgrade –latest vue-template-compiler

===================================
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Adminstrtor\AppData\Roaming:这个问题我的是在本地找不到提示的那个文件,所以我就直接:

    删除package-lock.json
    然后npm init -y
    最后npm i
运行项目:  npm run dev

打包:npm run build,打包后会出现dist文件夹

nginx启动:brew services start nginx
nginx重启:brew services restart nginx


nginx启动
1、启动nginx:sudo nginx
2、关闭nginx:sudo nginx -s  stop
3、重启nginx:sudo nginx -s reload


nginx配置:cd /usr/local/etc/nginx/
vim nginx.conf
把dist路径放在这里:
location / {
            root   /Users/xxxxx/workspaces/ideaWorkSpace/myVue/mVue/dist;
            index  index.html index.htm;
        }

nginx部署普通h5项目:
在nginx中创建一个文件夹将项目放入,然后在nginx.conf配置指向这个项目路径代理即可:
        location /hello {
            alias   /usr/local/etc/nginx/html/hello;                        
            try_files $uri $uri/ /hello/index.html;
            index  index.html index.htm;

        }


使用webpack创建vue:

1.sudo cnpm install -g vue-cli(安装脚手架)
2.vue init webpack myvue(项目名)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值