搭建vue项目工程

1、安装好webpack、vue及vue-cli脚手架工具(具体可看上一篇);
2、到工程目录下,打开cmd,vue init webpack myVue1,其中,myVue1是建的工程文件夹的名称(你想叫啥子就叫啥子),webpack代表这个工程是在webpack的基础下构建的;
3、之后会出现在需要你填入的项目名称、描述、代码审查、单元测试等;
这里写图片描述
4、进入文件目录 cd myVue1
5、根据上面的package.json安装npm包文件,npm install
!!注意啦,就在npm install出现了问题,报错如下

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\think\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! chromedriver@2.28.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chromedriver@2.28.0 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the chromedriver package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs chromedriver
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls chromedriver
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     F:\kjStudy\vue\vueJs\firstVue\npm-debug.log

这又让我奔溃鸟,我又回到管理员身份运行全局安装npm install -g chromedriver,装是装好了,但是回到项目里面又来一遍npm install,还是报一样的错误,实属无奈,又使劲百度。。百度到:

”经分析发现,某些版本下,chromedriver 的 zip 文件 url 的响应是 302 跳转,而在 install.js 里使用的是 Node.js 内置的 http 对象的 get 方法无法处理 302 跳转的情况;而在另外一些情况下,则是因为 googleapis.com 被墙了,此时即使采用科学上网的方法也仍然无法获取文件。”看不是很看得懂,但是解决方法倒是写得很清楚,使用:

npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

果然,终于没有再报错了,再使用npm install,,完成安装。
6、使用npm run dev,,ok~~终于跑起来了http://localhost:8080/#/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值