---
title: "npm设置代理 以及 重定向"
author: "zybing"
date: "2013-07-30T10:49:31Z"
tags: []
categories: ["非技术"]
slug: "npm"
draft: false
lastmod: "2013-07-30T10:51:11Z"
id: 1915411
url: "https://zybing.iteye.com/blog/1915411"
---

node.js通过npm安装模块，

npm的代理设置法：

npm config set proxy=http://192.168.0.2:8080

重定向其他镜像网站：  
npm config set registry http://registry.npmjs.vitecho.com

或者在：~/.npmrc 加入下面内容

registry = http://registry.npmjs.vitecho.com

在安装node.js的模块时，有时候是下载源码需要本地安装编译，需要用到python以及C++编译器，因此在本机上最好有这些条件