记录配置vue项目开发环境的几个小坑

在一台新电脑上面,跑之前的vue项目,安装了nodejs 版本v12.13.1,自带的npm版本是v6.12.1,一开始跑不起来,查资料解决了,记录一下问题

1、配置环境变量

path D:\nodejs\node_global
path D:\nodejs\node_cache
path D:\nodejs
path C:\Python27\
path D:\Program Files\Git\cmd

其中python和git需要自己安装

2、npm相关操作

设置淘宝镜像
npm config set registry https://registry.npm.taobao.org
清理缓存
npm cache clean --force
获取npm镜像地址
npm get registry
安装(不带镜像地址)
npm install 
安装(带镜像地址)
npm install --registry=https://registry.npm.taobao.org
安装指定的依赖包
npm install 包名@版本号       例如:npm install node-sass@4.14.1

3、相关错误处理

3.1 npm install提示连接不到git错误

error kex_exchange_identification: Connection closed by remote host
error Connection closed by 20.205.243.166 port 22
error fatal: Could not read from remote repository.
解决方法:
修改git的协议
git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
再次执行npm install

3.2 npm install提示安装node-sass错误

error node-sass@4.14.1 postinstall: `node scripts/build.js`
error Failed at the node-sass@4.14.1 postinstall script.
解决方法:
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
单独执行 npm install node-sass@4.14.1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值