Windows 下安装NPM & node.js(VUE开发环境必备)

17 篇文章 1 订阅
9 篇文章 0 订阅

第一步: 下载node.js的windows版
 当前最新版本是https://nodejs.org/dist/
 
第二步:设置环境变量
把node.exe所在目录加入到PATH环境变量中。
配置成功后可以在CMD中通过node --version 看到node.js对应的版本号
C:\Users\fn>node --version
v6.10.2

第三步: 安装git
直接到以下地址 https://git-scm.com/download/win 下载Git windows安装文,按照提示一步步安装即可。

安装完成后把git安装bin目录加入PATH环境变量

找到git安装路径中bin的位置,如:D:\Program Files\Git\bin

找到git安装路径中git-core的位置,如:D:\Program Files\Git\libexec\git-core;

CMD中运行 git --version 确认安装是否成功

C:\Users\fn>git --version
git version 1.7.7.msysgit.1

第四步: 安装 npm
在确保node.exe和git都在PATH环境变量中后执行以下命令:

git config --system http.sslcainfo /bin/curl-ca-bundle.crt

git clone --recursive git://github.com/isaacs/npm.git


cd npm

node cli.js install npm -gf
下面来测试一下是否成功,一切OK开始Node.JS之旅

D:\develop\nodejs\hello>npm install -d
npm info it worked if it ends with ok
npm info using npm@1.0.103
npm info using node@v0.5.10
npm info preinstall application-name@0.0.1
npm info addNamed [ 'jade', '>= 0.0.1' ]
npm info addNamed [ 'express', '2.5.0' ]

最好设置下国内镜像要不然下载会很慢

github npm 撞墙的解决方案。 

github: 
代理服务器是必须的,我用的是本地的astrill 
给curl设置代理 
export http_proxy="127.0.0.1:3213" 
export https_proxy="127.0.0.1:3213" 
ok了 

npm: 
设置国内镜像:

  npm config set registry http://registry.npmjs.vitecho.com

  npm config set registry https://registry.npmmirror.com 
 

注意:淘宝镜像过期了!
其实,早在 2021 年,淘宝就发文称,npm 淘宝镜像已经从 registry.npm.taobao.org 切换到了 registry.npmmirror.com。旧域名也将于 2022 年 5 月 31 日停止服务(不过,直到今天 HTTPS 证书到期才真正不能用了) 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值