标签:npm vue cli yarn set taobao https config 搭建
https://www.jianshu.com/p/8d5aeb79d7ad
一、安装 Node.js 10(选择自己需要的版本)
运行 node -v
查看版本,如果不是 10,请先卸载当前版本去 Node.js 官网下载10.12.0版的安装包,一路点击下一步,注意安装目录可以改,一定不要在路径中出现中文和空格。
注意重装 Node.js 后,你以前用 npm 或 yarn 全局安装的命令可能都会消失不见,如果你需要,可以需要重新全局安装这些命令。打开 Git Bash或cmd,依次输入以下命令,按回车:
npm config set registry https://registry.npm.taobao.org/
npm config set loglevel http
npm config set progress false
二、安装yarn(yarn比npm更加好用)
打开 Git Bash,输入以下命令,按回车。
npm install -g yarn
三、安装yarn淘宝源和npm淘宝源(下载依赖更快,否则你就体验一下等待痛苦)
yarn设置镜像:
yarn config set registry https://registry.npm.taobao.org -g
yarn config set disturl https://npm.taobao.org/dist -g
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g
npm设置为淘宝镜像
npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist
npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
四、安装vue/cli(选择自己需要版本)
运行 vue --version
查看版本,如果不是 4.1.2,运行npm uninstall -g @vue/cli
卸载当前版本
1、安装vue/cli:yarn global add @vue/cli@4.1.2
2、检查版本号:vue --version
3、创建记账文件records:
vue create records
(用cmd运行这个)
winpty vue.cmd create records
(用git bash运行这个)
这是因为window系统使用git bash,交互提示符并不工作,你不能切换选项,你必须通过 winpty vue.cmd create 文件名
来激活,而cmd是可以直接利用上下箭头键进行切换。他们都是空格键是进行选中或取消,回车键进行确认。
配置完之后,就会进行安装依赖。安装时候,如果出现如下图所示问题
作者:飞天小猪_pig
链接:https://www.jianshu.com/p/8d5aeb79d7ad
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
标签:npm,vue,cli,yarn,set,taobao,https,config,搭建 来源: https://www.cnblogs.com/zhoading/p/16411165.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。